diff --git a/lib/login/register/starLock_register_page.dart b/lib/login/register/starLock_register_page.dart index a1d2c7ff..cec34d5a 100755 --- a/lib/login/register/starLock_register_page.dart +++ b/lib/login/register/starLock_register_page.dart @@ -30,39 +30,41 @@ class _StarLockRegisterPageState extends State { return Scaffold( resizeToAvoidBottomInset: false, backgroundColor: const Color(0xFFFFFFFF), - appBar: TitleAppBar( - barTitle: '注册'.tr, - haveBack: true, - backgroundColor: AppColors.mainColor), - body: ListView( - padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w), - children: [ - topSelectCountryAndRegionWidget(), - middleTFWidget(), - Obx(() { - return SubmitBtn( - btnName: '注册'.tr, - // backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey], - fontSize: 30.sp, - borderRadius: 20.w, - padding: EdgeInsets.only(top: 25.w, bottom: 25.w), - isDisabled: state.canSub.value, - onClick: state.canSub.value - ? () { - if (state.agree.value == false) { - logic.showToast('请先同意用户协议及隐私政策'.tr); - return; - } else { - logic.register(); + appBar: TitleAppBar(barTitle: '注册'.tr, haveBack: true, backgroundColor: AppColors.mainColor), + body: GestureDetector( + onTap: () { + FocusScope.of(context).unfocus(); + }, + child: ListView( + padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w), + children: [ + topSelectCountryAndRegionWidget(), + middleTFWidget(), + Obx(() { + return SubmitBtn( + btnName: '注册'.tr, + // backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey], + fontSize: 30.sp, + borderRadius: 20.w, + padding: EdgeInsets.only(top: 25.w, bottom: 25.w), + isDisabled: state.canSub.value, + onClick: state.canSub.value + ? () { + if (state.agree.value == false) { + logic.showToast('请先同意用户协议及隐私政策'.tr); + return; + } else { + logic.register(); + } } - } - : null); - }), - SizedBox( - height: 20.h, - ), - _buildBottomAgreement() - ], + : null); + }), + SizedBox( + height: 20.h, + ), + _buildBottomAgreement() + ], + ), )); } @@ -77,9 +79,7 @@ class _StarLockRegisterPageState extends State { width: 340.w, height: 60.h, decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(30.h)), - border: - Border.all(width: 1.0, color: AppColors.greyLineColor)), + borderRadius: BorderRadius.all(Radius.circular(30.h)), border: Border.all(width: 1.0, color: AppColors.greyLineColor)), child: Row( children: [ GestureDetector( @@ -93,18 +93,13 @@ class _StarLockRegisterPageState extends State { decoration: state.isIphoneType.value ? BoxDecoration( color: AppColors.mainColor, - borderRadius: - BorderRadius.all(Radius.circular(30.h)), - border: Border.all( - width: 1.0, color: AppColors.greyLineColor)) + borderRadius: BorderRadius.all(Radius.circular(30.h)), + border: Border.all(width: 1.0, color: AppColors.greyLineColor)) : null, child: Center( child: Text( '手机'.tr, - style: TextStyle( - color: state.isIphoneType.value - ? Colors.white - : Colors.black), + style: TextStyle(color: state.isIphoneType.value ? Colors.white : Colors.black), ), ), ), @@ -121,19 +116,14 @@ class _StarLockRegisterPageState extends State { decoration: !state.isIphoneType.value ? BoxDecoration( color: AppColors.mainColor, - borderRadius: - BorderRadius.all(Radius.circular(30.h)), - border: Border.all( - width: 1.0, - color: AppColors.greyLineColor)) + borderRadius: BorderRadius.all(Radius.circular(30.h)), + border: Border.all(width: 1.0, color: AppColors.greyLineColor)) : null, child: Center( child: Text( '邮箱'.tr, style: TextStyle( - color: !state.isIphoneType.value - ? Colors.white - : Colors.black, + color: !state.isIphoneType.value ? Colors.white : Colors.black, ), ), ), @@ -163,21 +153,15 @@ class _StarLockRegisterPageState extends State { child: Row( children: [ SizedBox(width: 5.w), - Expanded( - child: Text('你所在的国家/地区'.tr, - style: TextStyle( - fontSize: 26.sp, color: AppColors.blackColor))), + Expanded(child: Text('你所在的国家/地区'.tr, style: TextStyle(fontSize: 26.sp, color: AppColors.blackColor))), SizedBox(width: 20.w), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ Text( - state.isIphoneType.value - ? '${state.countryName.value} +${state.countryCode.value}' - : state.countryName.value, + state.isIphoneType.value ? '${state.countryName.value} +${state.countryCode.value}' : state.countryName.value, textAlign: TextAlign.end, - style: TextStyle( - fontSize: 26.sp, color: AppColors.blackColor), + style: TextStyle(fontSize: 26.sp, color: AppColors.blackColor), ) ], ), @@ -212,9 +196,7 @@ class _StarLockRegisterPageState extends State { Padding( padding: EdgeInsets.only(right: 5.w, left: 5.w), child: Image.asset( - state.isIphoneType.value - ? 'images/icon_login_account.png' - : 'images/icon_login_email.png', + state.isIphoneType.value ? 'images/icon_login_account.png' : 'images/icon_login_email.png', width: 30.w, height: 30.w, ), @@ -248,8 +230,7 @@ class _StarLockRegisterPageState extends State { SizedBox(height: 15.w), Text( '密码必须是8-20位,至少包括数字/字母/符号中的2种'.tr, - style: - TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp), + style: TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp), ), SizedBox(height: 10.w), LoginInput( @@ -299,14 +280,9 @@ class _StarLockRegisterPageState extends State { onTap: (state.canSendCode.value && state.canResend.value) ? () async { // Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value}); - final Object? result = await Navigator.pushNamed( - context, Routers.safetyVerificationPage, - arguments: { - 'countryCode': state.countryCode, - 'account': state.phoneOrEmailStr.value - }); - state.xWidth.value = - (result! as Map)['xWidth']; + final Object? result = await Navigator.pushNamed(context, Routers.safetyVerificationPage, + arguments: {'countryCode': state.countryCode, 'account': state.phoneOrEmailStr.value}); + state.xWidth.value = (result! as Map)['xWidth']; logic.sendValidationCode(); } : null, @@ -315,10 +291,7 @@ class _StarLockRegisterPageState extends State { // height: 60.h, padding: EdgeInsets.all(10.h), decoration: BoxDecoration( - color: - (state.canSendCode.value && state.canResend.value) - ? AppColors.mainColor - : Colors.grey, + color: (state.canSendCode.value && state.canResend.value) ? AppColors.mainColor : Colors.grey, borderRadius: BorderRadius.circular(5)), child: Center( child: Text(state.btnText.value, @@ -347,9 +320,7 @@ class _StarLockRegisterPageState extends State { logic.changeAgreeState(); }, child: Image.asset( - state.agree.value - ? 'images/icon_round_select.png' - : 'images/icon_round_unSelect.png', + state.agree.value ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w, ))), @@ -365,29 +336,17 @@ class _StarLockRegisterPageState extends State { WidgetSpan( alignment: PlaceholderAlignment.middle, child: GestureDetector( - child: Text('《${'用户协议'.tr}》', - style: TextStyle( - color: AppColors.mainColor, fontSize: 20.sp)), + child: Text('《${'用户协议'.tr}》', style: TextStyle(color: AppColors.mainColor, fontSize: 20.sp)), onTap: () { - Get.toNamed(Routers.webviewShowPage, - arguments: { - 'url': XSConstantMacro.userAgreementURL, - 'title': '用户协议'.tr - }); + Get.toNamed(Routers.webviewShowPage, arguments: {'url': XSConstantMacro.userAgreementURL, 'title': '用户协议'.tr}); }, )), WidgetSpan( alignment: PlaceholderAlignment.middle, child: GestureDetector( - child: Text('《${'隐私政策'.tr}》', - style: TextStyle( - color: AppColors.mainColor, fontSize: 20.sp)), + child: Text('《${'隐私政策'.tr}》', style: TextStyle(color: AppColors.mainColor, fontSize: 20.sp)), onTap: () { - Get.toNamed(Routers.webviewShowPage, - arguments: { - 'url': XSConstantMacro.privacyPolicyURL, - 'title': '隐私政策'.tr - }); + Get.toNamed(Routers.webviewShowPage, arguments: {'url': XSConstantMacro.privacyPolicyURL, 'title': '隐私政策'.tr}); }, )), ], diff --git a/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart b/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart index 0a136aa8..c0500019 100755 --- a/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart +++ b/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart @@ -82,8 +82,7 @@ class _DoorLockLogPageState extends State with RouteAware { backgroundColor: AppColors.mainColor, actionsList: [ Visibility( - visible: CommonDataManage().currentKeyInfo.isLockOwner == 1 || - CommonDataManage().currentKeyInfo.keyRight == 1, + visible: CommonDataManage().currentKeyInfo.isLockOwner == 1 || CommonDataManage().currentKeyInfo.keyRight == 1, child: GestureDetector( child: Image.asset( 'images/icon_tips_Q.png', @@ -92,27 +91,20 @@ class _DoorLockLogPageState extends State with RouteAware { color: Colors.white, ), onTap: () { - ShowTipView().showSureAlertDialog( - '1.锁没有联网,密码、IC卡、指纹等开门记录无法实时上传,可以点击右上角按钮,然后读取记录。'.tr + - '\n' + - '2.如果您需要保留历史记录,可以点击右上角按钮,然后导出记录'.tr, - tipTitle: '看不到操作记录,可能原因有'.tr, - sureStr: '我知道了'.tr); + ShowTipView().showSureAlertDialog('1.锁没有联网,密码、IC卡、指纹等开门记录无法实时上传,可以点击右上角按钮,然后读取记录。'.tr + '\n' + '2.如果您需要保留历史记录,可以点击右上角按钮,然后导出记录'.tr, + tipTitle: '看不到操作记录,可能原因有'.tr, sureStr: '我知道了'.tr); }, )), Visibility( - visible: CommonDataManage().currentKeyInfo.isLockOwner == 1 || - CommonDataManage().currentKeyInfo.keyRight == 1, + visible: CommonDataManage().currentKeyInfo.isLockOwner == 1 || CommonDataManage().currentKeyInfo.keyRight == 1, child: PopupMenuButton( onSelected: _onMenuItemSelected, color: Colors.black, itemBuilder: (BuildContext context) { return >[ _buildCustomPopupMenuItem('读取记录'.tr), - if (CommonDataManage().currentKeyInfo.isLockOwner == 1) - const PopupMenuDivider(), - if (CommonDataManage().currentKeyInfo.isLockOwner == 1) - _buildCustomPopupMenuItem('清空记录'.tr), + if (CommonDataManage().currentKeyInfo.isLockOwner == 1) const PopupMenuDivider(), + if (CommonDataManage().currentKeyInfo.isLockOwner == 1) _buildCustomPopupMenuItem('清空记录'.tr), const PopupMenuDivider(), _buildCustomPopupMenuItem('导出记录'.tr), ]; @@ -130,11 +122,7 @@ class _DoorLockLogPageState extends State with RouteAware { body: Column( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.start, - children: [ - topAdvancedCalendarWidget(), - eventDropDownWidget(), - Expanded(child: timeLineView()) - ], + children: [topAdvancedCalendarWidget(), eventDropDownWidget(), Expanded(child: timeLineView())], ), floatingActionButton: Visibility( visible: _isAtBottom, @@ -193,8 +181,7 @@ class _DoorLockLogPageState extends State with RouteAware { builder: (BuildContext context) { return ExportRecordDialog( onExport: (String filePath) { - Get.toNamed(Routers.exportSuccessPage, - arguments: {'filePath': filePath}); + Get.toNamed(Routers.exportSuccessPage, arguments: {'filePath': filePath}); }, ); }, @@ -271,8 +258,7 @@ class _DoorLockLogPageState extends State with RouteAware { String formatTimestampToDateTimeYYYYMMDD(int timestampMs) { DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(timestampMs); - DateFormat formatter = - DateFormat('MM${'月'.tr}dd${'日'.tr}'); // 格式:2025-08-18 14:30 + DateFormat formatter = DateFormat('MM${'月'.tr}dd${'日'.tr}'); // 格式:2025-08-18 14:30 return formatter.format(dateTime); } @@ -300,103 +286,71 @@ class _DoorLockLogPageState extends State with RouteAware { final recordType = item.recordType; switch (recordType) { case 10: - if (item.username != null && item.username != '') { - return '${formatTimestampToHHmm(item.operateDate!)} ' + - '指纹'.tr + - '开锁'.tr + - '(ID:${item.username})'; - } else { - return item.recordStr ?? ''; - } + return '${formatTimestampToHHmm(item.operateDate!)} ' + '指纹'.tr + '开锁'.tr + '(${_formatUserNameOrId(item)})'; case 20: return '${formatTimestampToHHmm(item.operateDate!)} ' + '密码'.tr + '开锁'.tr + - '(${'昵称'.tr}:${item.username})' + + '(${_formatUserNameOrId(item)})' + '(${'密码'.tr}:${item.keyboardPwd})'; case 30: - return '${formatTimestampToHHmm(item.operateDate!)} ' + - '卡'.tr + - '开锁'.tr + - '(${'昵称'.tr}:${item.username})'; + return '${formatTimestampToHHmm(item.operateDate!)} ' + '卡'.tr + '开锁'.tr + '(${_formatUserNameOrId(item)})'; case 40: if (item.username != null && item.username != '') { - return '${formatTimestampToHHmm(item.operateDate!)} ' + - '蓝牙'.tr + - '开锁'.tr + - '(' + - '${'昵称'.tr}'.tr + - ':${item.username})'; + return '${formatTimestampToHHmm(item.operateDate!)} ' + '蓝牙'.tr + '开锁'.tr + '(${_formatUserNameOrId(item)})'; } else { - return '${formatTimestampToHHmm(item.operateDate!)} ' + - '蓝牙'.tr + - '开锁'.tr + - '(' + - 'ID'.tr + - ':${item.userid})'; + return '${formatTimestampToHHmm(item.operateDate!)} ' + '蓝牙'.tr + '开锁'.tr + '(' + 'ID'.tr + ':${item.userid})'; } - case 50: - return '${formatTimestampToHHmm(item.operateDate!)} ' + - '组合模式'.tr + - '开锁'.tr + - '(${'昵称'.tr}:${item.username})'; + return '${formatTimestampToHHmm(item.operateDate!)} ' + '组合模式'.tr + '开锁'.tr + '(${_formatUserNameOrId(item)})'; case 60: - return '${formatTimestampToHHmm(item.operateDate!)} ' + - '添加'.tr + - '指纹'.tr + - '(${'昵称'.tr}:${item.username})'; + return '${formatTimestampToHHmm(item.operateDate!)} ' + '添加'.tr + '指纹'.tr + '(${_formatUserNameOrId(item)})'; case 70: - return '${formatTimestampToHHmm(item.operateDate!)} ' + - '添加'.tr + - '密码'.tr + - '(${'昵称'.tr}:${item.username})'; + return '${formatTimestampToHHmm(item.operateDate!)} ' + '添加'.tr + '密码'.tr + '(${_formatUserNameOrId(item)})'; case 80: - return '${formatTimestampToHHmm(item.operateDate!)} ' + - '添加'.tr + - '卡'.tr + - '(${'昵称'.tr}:${item.username})'; + return '${formatTimestampToHHmm(item.operateDate!)} ' + '添加'.tr + '卡'.tr + '(${_formatUserNameOrId(item)})'; case 90: - return '${formatTimestampToHHmm(item.operateDate!)} ' + - '删除'.tr + - '指纹'.tr + - '(${'昵称'.tr}:${item.username})'; + return '${formatTimestampToHHmm(item.operateDate!)} ' + '删除'.tr + '指纹'.tr + '(${_formatUserNameOrId(item)})'; case 100: - return '${formatTimestampToHHmm(item.operateDate!)} ' + - '删除'.tr + - '密码'.tr + - '(${'昵称'.tr}:${item.username})'; + return '${formatTimestampToHHmm(item.operateDate!)} ' + '删除'.tr + '密码'.tr + '(${_formatUserNameOrId(item)})'; case 110: - return '${formatTimestampToHHmm(item.operateDate!)} ' + - '删除'.tr + - '卡'.tr + - '(${'昵称'.tr}:${item.username})'; + return '${formatTimestampToHHmm(item.operateDate!)} ' + '删除'.tr + '卡'.tr + '(${_formatUserNameOrId(item)})'; case 160: - return '${formatTimestampToHHmm(item.operateDate!)} ' + - '人脸'.tr + - '开锁'.tr + - '(${'昵称'.tr}:${item.username})'; + return '${formatTimestampToHHmm(item.operateDate!)} ' + '人脸'.tr + '开锁'.tr + '(${_formatUserNameOrId(item)})'; case 190: - return '${formatTimestampToHHmm(item.operateDate!)} ' + - '胁迫指纹'.tr + - '开锁'.tr + - '(${'昵称'.tr}:${item.username})'; + return '${formatTimestampToHHmm(item.operateDate!)} ' + '胁迫指纹'.tr + '开锁'.tr + '(${_formatUserNameOrId(item)})'; case 200: - return '${formatTimestampToHHmm(item.operateDate!)} ' + - '胁迫密码'.tr + - '开锁'.tr + - '(${'昵称'.tr}:${item.username})'; + return '${formatTimestampToHHmm(item.operateDate!)} ' + '胁迫密码'.tr + '开锁'.tr + '(${_formatUserNameOrId(item)})'; case 210: - return '${formatTimestampToHHmm(item.operateDate!)} ' + - '胁迫卡片'.tr + - '开锁'.tr + - '(${'昵称'.tr}:${item.username})'; + return '${formatTimestampToHHmm(item.operateDate!)} ' + '胁迫卡片'.tr + '开锁'.tr + '(${_formatUserNameOrId(item)})'; default: return item.recordStr ?? ''; } } + // 提取为私有方法,更清晰 + String _formatUserNameOrId(DoorLockLogDataItem item) { + final recordStr = item.recordStr; + final idMatch = RegExp(r'ID[::](\w+)').firstMatch(recordStr ?? ''); + final idValue = idMatch?.group(1) ?? ''; + + final name = item.username ?? ''; + + // 如果用户名不为空,并且是以 ID: 或 ID: 开头的格式,则直接返回 ID:xxx + if (name.isNotEmpty) { + final idInNameMatch = RegExp(r'^ID[::].+').hasMatch(name); + if (idInNameMatch) { + return name; // 直接返回,例如 "ID:123" + } else { + return '${'昵称'.tr}:$name'; // 正常用户昵称,加前缀 + } + } + + // 如果用户名为空,使用 recordStr 中提取的 ID + return 'ID:$idValue'; + } + Color _buildTextColorByType(DoorLockLogDataItem item) { final recordType = item.recordType; switch (recordType) { @@ -420,12 +374,9 @@ class _DoorLockLogPageState extends State with RouteAware { contentsBuilder: (BuildContext context, int index) { final DoorLockLogDataItem timelineData = state.lockLogItemList[index]; // 👇 提前计算第一个有 videoUrl 的索引(可以在 build 外层计算一次,避免重复) - int? firstVideoIndex = state.lockLogItemList - .indexWhere((item) => _checkIsVideoOrImagesType(item)); + int? firstVideoIndex = state.lockLogItemList.indexWhere((item) => _checkIsVideoOrImagesType(item)); bool isInvalid = _checkIsVideoOrImagesType(timelineData) && - ((timelineData.imagesUrl == null && - timelineData.videoUrl == null) || - (timelineData.videoUrl == '' && timelineData.imagesUrl == '')); + ((timelineData.imagesUrl == null && timelineData.videoUrl == null) || (timelineData.videoUrl == '' && timelineData.imagesUrl == '')); String typeText = ''; if (timelineData.recordType == 130) { @@ -446,8 +397,7 @@ class _DoorLockLogPageState extends State with RouteAware { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - '${formatTimestampToDateTimeYYYYMMDD(timelineData.operateDate!)}', + Text('${formatTimestampToDateTimeYYYYMMDD(timelineData.operateDate!)}', style: TextStyle( fontSize: 20.sp, )), @@ -464,12 +414,7 @@ class _DoorLockLogPageState extends State with RouteAware { ), children: [ TextSpan( - text: _buildIDByType(timelineData) + - (isInvalid - ? '(${typeText}' + - '已失效'.tr + - ')' - : ''), + text: _buildIDByType(timelineData) + (isInvalid ? '(${typeText}' + '已失效'.tr + ')' : ''), ), WidgetSpan( alignment: PlaceholderAlignment.middle, @@ -504,8 +449,7 @@ class _DoorLockLogPageState extends State with RouteAware { height: 12.h, ), Visibility( - visible: _checkIsVideoOrImagesType(timelineData) && - index == firstVideoIndex, + visible: _checkIsVideoOrImagesType(timelineData) && index == firstVideoIndex, child: GestureDetector( onTap: () async { await logic.getWebPlayUrl(); @@ -580,9 +524,7 @@ class _DoorLockLogPageState extends State with RouteAware { if (recordData.videoUrl != null && recordData.videoUrl!.isNotEmpty) { final lockLogItemList = state.lockLogItemList.value; final list = lockLogItemList - .where((e) => - (e.videoUrl != null && e.videoUrl!.isNotEmpty) || - (e.imagesUrl != null && e.imagesUrl!.isNotEmpty)) + .where((e) => (e.videoUrl != null && e.videoUrl!.isNotEmpty) || (e.imagesUrl != null && e.imagesUrl!.isNotEmpty)) .map( (e) => RecordListData( videoUrl: e.videoUrl, @@ -593,16 +535,13 @@ class _DoorLockLogPageState extends State with RouteAware { ), ) .toList(); - final selectDateString = - DateTool().dateToYMDString(state.startDate.value.toString()); - final cloudStorageData = - CloudStorageData(date: selectDateString, recordList: list); + final selectDateString = DateTool().dateToYMDString(state.startDate.value.toString()); + final cloudStorageData = CloudStorageData(date: selectDateString, recordList: list); Get.toNamed(Routers.videoLogDetailPage, arguments: { 'recordData': recordData, 'videoDataList': [cloudStorageData] }); - } else if (recordData.imagesUrl != null && - recordData.imagesUrl!.isNotEmpty) { + } else if (recordData.imagesUrl != null && recordData.imagesUrl!.isNotEmpty) { Navigator.push( context, MaterialPageRoute( @@ -613,8 +552,7 @@ class _DoorLockLogPageState extends State with RouteAware { ); } }, - child: ((recordData.imagesUrl != null && recordData.imagesUrl != '') || - (recordData.videoUrl != null && recordData.videoUrl != '')) + child: ((recordData.imagesUrl != null && recordData.imagesUrl != '') || (recordData.videoUrl != null && recordData.videoUrl != '')) ? Container( width: 260.w, height: 260.h, @@ -632,8 +570,7 @@ class _DoorLockLogPageState extends State with RouteAware { _buildImageOrVideoItem(RecordListData recordData) { if (recordData.videoUrl != null && recordData.videoUrl!.isNotEmpty) { return _buildVideoItem(recordData); - } else if (recordData.imagesUrl != null && - recordData.imagesUrl!.isNotEmpty) { + } else if (recordData.imagesUrl != null && recordData.imagesUrl!.isNotEmpty) { return _buildImageItem(recordData); } else { return SizedBox.shrink(); @@ -650,8 +587,7 @@ class _DoorLockLogPageState extends State with RouteAware { child: Image.network( recordData.imagesUrl!, fit: BoxFit.cover, - errorBuilder: - (BuildContext context, Object error, StackTrace? stackTrace) { + errorBuilder: (BuildContext context, Object error, StackTrace? stackTrace) { // 图片加载失败时显示错误图片 return Image.asset( 'images/icon_unHaveData.png', // 错误图片路径 @@ -749,11 +685,8 @@ class _DoorLockLogPageState extends State with RouteAware { print('外部收到选中: $date'); state.operateDate = date.millisecondsSinceEpoch; - state.startDate.value = - DateTime(date.year, date.month, date.day).millisecondsSinceEpoch; - state.endDate.value = - DateTime(date.year, date.month, date.day, 23, 59, 59, 999) - .millisecondsSinceEpoch; + state.startDate.value = DateTime(date.year, date.month, date.day).millisecondsSinceEpoch; + state.endDate.value = DateTime(date.year, date.month, date.day, 23, 59, 59, 999).millisecondsSinceEpoch; await logic.mockNetworkDataRequest(isRefresh: true); }, onWeekChanged: (DateTime start, DateTime end) { diff --git a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index 2d930e9a..e122ccf1 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -8,6 +8,12 @@ import 'package:intl/intl.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:star_lock/apm/apm_helper.dart'; import 'package:star_lock/appRouters.dart'; +import 'package:star_lock/blue/io_protocol/io_updataLockCardList.dart'; +import 'package:star_lock/blue/io_protocol/io_updataLockFaceList.dart'; +import 'package:star_lock/blue/io_protocol/io_updataLockFingerprintList.dart'; +import 'package:star_lock/blue/io_protocol/io_updataLockPalmVeinList.dart'; +import 'package:star_lock/blue/io_protocol/io_updataLockPasswordList.dart'; +import 'package:star_lock/blue/io_protocol/io_updataLockRemoteControlList.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; @@ -46,23 +52,50 @@ class LockDetailLogic extends BaseGetXController { final LockDetailState state = LockDetailState(); //节流器,用来限制开锁按钮的触发频率 - FunctionBlocker functionBlocker = - FunctionBlocker(duration: const Duration(seconds: 2)); + FunctionBlocker functionBlocker = FunctionBlocker(duration: const Duration(seconds: 2)); // 监听设备返回的数据 void initReplySubscription() { - state.replySubscription = - EventBusManager().eventBus!.on().listen((Reply reply) async { + state.replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) async { // 开门 if (reply is OpenDoorReply) { _replyOpenLock(reply); } // 开完锁之后上传记录 - if (reply is SenderReferEventRecordTimeReply && - state.ifCurrentScreen.value == true) { + if (reply is SenderReferEventRecordTimeReply && state.ifCurrentScreen.value == true) { await _replyReferEventRecordTime(reply); } + + // 上传数据获取锁密码列表 + if (reply is UpdataLockPasswordListReply && (state.ifCurrentScreen.value == true)) { + _replyUpdataLockPasswordListReply(reply); + } + + // 上传数据获取锁卡列表 + if (reply is UpdataLockCardListReply && (state.ifCurrentScreen.value == true)) { + _replyUpdataLockCardListReply(reply); + } + + // 上传数据获取锁指纹列表 + if (reply is UpdataLockFingerprintListReply && (state.ifCurrentScreen.value == true)) { + _replyUpdataLockFingerprintListReply(reply); + } + + // 上传数据获取锁人脸列表 + if (reply is UpdataLockFaceListReply && (state.ifCurrentScreen.value == true)) { + _replyUpdataLockFaceListReply(reply); + } + + // 上传数据获取锁掌静脉列表 + if (reply is UpdataLockPalmVeinListReply && (state.ifCurrentScreen.value == true)) { + _replyUpdataLockPalmVeinListReply(reply); + } + + // 上传数据获取锁遥控 + if (reply is UpdataLockRemoteControlListReply && (state.ifCurrentScreen.value == true)) { + _replyUpdataLockRemoteControlListReply(reply); + } }); } @@ -70,17 +103,13 @@ class LockDetailLogic extends BaseGetXController { Future _replyOpenLock(Reply reply) async { final int status = reply.data[6]; - BuglyTool.uploadException( - message: '开锁结果,解析数据', - detail: '开锁结果,解析数据 _replyOpenLock:${reply.data}', - upload: true); + BuglyTool.uploadException(message: '开锁结果,解析数据', detail: '开锁结果,解析数据 _replyOpenLock:${reply.data}', upload: true); if (status != 6) { final String getMobile = (await Storage.getMobile())!; ApmHelper.instance.trackEvent('open_lock', { 'lock_name': state.keyInfos.value.lockName!, - 'account': - getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!, + 'account': getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!, 'date': DateTool().getNowDateWithType(1), 'open_lock_result': '${reply.data}', }); @@ -95,8 +124,7 @@ class LockDetailLogic extends BaseGetXController { state.closedUnlockSuccessfulTimer?.cancel(); EasyLoading.dismiss(); // 如果没有点击关闭弹窗,3秒后自动关闭 - state.closedUnlockSuccessfulTimer = - Timer.periodic(3.seconds, (Timer timer) { + state.closedUnlockSuccessfulTimer = Timer.periodic(3.seconds, (Timer timer) { state.iSClosedUnlockSuccessfulPopup.value = false; timer.cancel(); eventBus.fire(RefreshLockDetailInfoDataEvent()); @@ -122,31 +150,28 @@ class LockDetailLogic extends BaseGetXController { getLockRecordLastUploadDataTime(); AppLog.log('开锁成功,结束同步所记录:getLockRecordLastUploadDataTime'); // 只有接听状态时才可以重发开门指令 - if (StartChartManage().talkStatus.status == - TalkStatus.answeredSuccessfully) { + if (StartChartManage().talkStatus.status == TalkStatus.answeredSuccessfully) { showToast('开锁成功'.tr); } // 如果是单次钥匙,则开锁成功之后调用删除 if (state.keyInfos.value.keyType == 3) { - final LockListInfoEntity entity = await ApiRepository.to - .deletOwnerKeyData( - lockId: state.keyInfos.value.lockId.toString(), - keyId: state.keyInfos.value!.keyId.toString(), - includeUnderlings: 0); + final LockListInfoEntity entity = await ApiRepository.to.deletOwnerKeyData( + lockId: state.keyInfos.value.lockId.toString(), + keyId: state.keyInfos.value!.keyId.toString(), + includeUnderlings: 0); if (entity.errorCode!.codeIsSuccessful) { AppLog.log("删除成功"); } } + + _handleSynchronizeUploadLockData(); break; case 0x06: //无权限 - final List? privateKey = - await Storage.getStringList(saveBluePrivateKey); - final List getPrivateKeyList = - changeStringListToIntList(privateKey!); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); - final List? signKey = - await Storage.getStringList(saveBlueSignKey); + final List? signKey = await Storage.getStringList(saveBlueSignKey); final List signKeyDataList = changeStringListToIntList(signKey!); final List tokenData = reply.data.sublist(2, 6); @@ -165,8 +190,7 @@ class LockDetailLogic extends BaseGetXController { privateKey: getPrivateKeyList, ); // 只有接听状态时才可以重发开门指令 - if (StartChartManage().talkStatus.status == - TalkStatus.answeredSuccessfully) { + if (StartChartManage().talkStatus.status == TalkStatus.answeredSuccessfully) { sendStarChartOpenLockMessage(reply); } @@ -228,8 +252,7 @@ class LockDetailLogic extends BaseGetXController { /// 发送星图的开门蓝牙透传命令 void sendStarChartOpenLockMessage(Reply reply) async { /// 无权限开门时,重新发送一个带token信息的开门信息 - final List? privateKey = - await Storage.getStringList(saveBluePrivateKey); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); final List getPrivateKeyList = changeStringListToIntList(privateKey!); final List? signKey = await Storage.getStringList(saveBlueSignKey); @@ -252,9 +275,7 @@ class LockDetailLogic extends BaseGetXController { ); final messageDetail = openLockCommand.packageData(); // 将 List 转换为十六进制字符串 - String hexString = messageDetail - .map((byte) => byte.toRadixString(16).padLeft(2, '0')) - .join(' '); + String hexString = messageDetail.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join(' '); // 发送远程开门消息 StartChartManage().sendRemoteUnLockMessage( bluetoothDeviceName: BlueManage().connectDeviceName, @@ -262,9 +283,7 @@ class LockDetailLogic extends BaseGetXController { ); } - Future loadData( - {required LockListInfoItemEntity lockListInfoItemEntity, - required bool isOnlyOneData}) async { + Future loadData({required LockListInfoItemEntity lockListInfoItemEntity, required bool isOnlyOneData}) async { state.keyInfos.value = lockListInfoItemEntity; CommonDataManage().currentLockUserNo = state.keyInfos.value.lockUserNo!; CommonDataManage().initUserNo = state.keyInfos.value.initUserNo!; @@ -272,8 +291,7 @@ class LockDetailLogic extends BaseGetXController { state.lockUserNo = state.keyInfos.value.lockUserNo!; - if (state.keyInfos.value.keyStatus == - XSConstantMacro.keyStatusWaitIneffective || + if (state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusWaitIneffective || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted || @@ -288,40 +306,32 @@ class LockDetailLogic extends BaseGetXController { state.isOnlyOneData = isOnlyOneData; state.senderUserId = state.keyInfos.value.senderUserId!; state.isAttendance.value = state.keyInfos.value.lockSetting!.attendance!; - state.isOpenLockNeedOnline.value = - state.keyInfos.value.lockSetting!.appUnlockOnline!; + state.isOpenLockNeedOnline.value = state.keyInfos.value.lockSetting!.appUnlockOnline!; state.electricQuantity.value = state.keyInfos.value.electricQuantity!; state.isOpenPassageMode.value = state.keyInfos.value.passageMode!; state.lockAlias.value = state.keyInfos.value.lockAlias!; - state.electricQuantityStandby.value = - state.keyInfos.value.electricQuantityStandby ?? 0; + state.electricQuantityStandby.value = state.keyInfos.value.electricQuantityStandby ?? 0; Storage.setString(saveLockAlias, state.lockAlias.value); - BlueManage().connectDeviceName = - state.keyInfos.value.bluetooth!.bluetoothDeviceName!; + BlueManage().connectDeviceName = state.keyInfos.value.bluetooth!.bluetoothDeviceName!; - final List publicKeyData = - state.keyInfos.value.bluetooth!.publicKey!.cast(); + final List publicKeyData = state.keyInfos.value.bluetooth!.publicKey!.cast(); final List saveStrList = changeIntListToStringList(publicKeyData); await Storage.setStringList(saveBluePublicKey, saveStrList); // 私钥 - final List privateKeyData = - state.keyInfos.value.bluetooth!.privateKey!.cast(); - final List savePrivateKeyList = - changeIntListToStringList(privateKeyData); + final List privateKeyData = state.keyInfos.value.bluetooth!.privateKey!.cast(); + final List savePrivateKeyList = changeIntListToStringList(privateKeyData); await Storage.setStringList(saveBluePrivateKey, savePrivateKeyList); // signKey - final List signKeyData = - state.keyInfos.value.bluetooth!.signKey!.cast(); + final List signKeyData = state.keyInfos.value.bluetooth!.signKey!.cast(); final List saveSignKeyList = changeIntListToStringList(signKeyData); await Storage.setStringList(saveBlueSignKey, saveSignKeyList); final bool ifHaveKey = await Storage.ifHaveKey(saveBlueToken); if (!ifHaveKey) { - final List saveTokenList = - changeIntListToStringList([0, 0, 0, 0]); + final List saveTokenList = changeIntListToStringList([0, 0, 0, 0]); Storage.setStringList(saveBlueToken, saveTokenList); } } @@ -373,8 +383,7 @@ class LockDetailLogic extends BaseGetXController { // AppLog.log('userNouserNouserNouserNo:$userNo'); if (userNo == 0xFFFF) { // 离线密码情况:16进制格式,去除结束符F(0x1F)及其之后的内容 - final List passwordData = - indexList.sublist(7, 17); // 取10个字节 + final List passwordData = indexList.sublist(7, 17); // 取10个字节 // 找到结束符F(0x1F)的位置 int endIndex = passwordData.indexOf(0x1F); if (endIndex == -1) { @@ -382,12 +391,9 @@ class LockDetailLogic extends BaseGetXController { endIndex = passwordData.length; } // 只取结束符前的部分(不包括结束符) - final List actualPasswordData = - passwordData.sublist(0, endIndex); + final List actualPasswordData = passwordData.sublist(0, endIndex); // 转换为十六进制字符串 - String passwordHex = actualPasswordData - .map((byte) => byte.toRadixString(16).padLeft(2, '0')) - .join(); + String passwordHex = actualPasswordData.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join(); // 过滤掉字母部分 passwordHex = passwordHex.replaceAll(RegExp(r'[^0-9]'), ''); @@ -409,9 +415,8 @@ class LockDetailLogic extends BaseGetXController { (0xff & indexList[5]) << 8 | (0xFF & indexList[6]); int operateDate = time * 1000; - if (DateTime.fromMillisecondsSinceEpoch(operateDate).isAfter( - DateTime.fromMillisecondsSinceEpoch( - getUTCNetTime() * 1000))) { + if (DateTime.fromMillisecondsSinceEpoch(operateDate) + .isAfter(DateTime.fromMillisecondsSinceEpoch(getUTCNetTime() * 1000))) { continue; } @@ -449,8 +454,7 @@ class LockDetailLogic extends BaseGetXController { // 点击开门事件 Future openDoorAction() async { - final List? privateKey = - await Storage.getStringList(saveBluePrivateKey); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); final List getPrivateKeyList = changeStringListToIntList(privateKey!); final List? signKey = await Storage.getStringList(saveBlueSignKey); @@ -478,8 +482,7 @@ class LockDetailLogic extends BaseGetXController { final String getMobile = (await Storage.getMobile())!; ApmHelper.instance.trackEvent('open_lock', { 'lock_name': state.keyInfos.value.lockName!, - 'account': - getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!, + 'account': getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!, 'date': DateTool().getNowDateWithType(1), 'open_lock_result': '超时', }); @@ -487,20 +490,14 @@ class LockDetailLogic extends BaseGetXController { resetOpenDoorState(); blueManageDisconnect(); BuglyTool.uploadException( - message: '开门超时处理-开锁失败', - detail: '开门超时,断开连接,开锁失败--OpenLockCommand:$command', - upload: true); + message: '开门超时处理-开锁失败', detail: '开门超时,断开连接,开锁失败--OpenLockCommand:$command', upload: true); }, ); - BlueManage() - .blueSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, - (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, + (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { - BuglyTool.uploadException( - message: '蓝牙连接成功', - detail: '蓝牙连接成功,发送开锁指令--OpenLockCommand:$command', - upload: false); + BuglyTool.uploadException(message: '蓝牙连接成功', detail: '蓝牙连接成功,发送开锁指令--OpenLockCommand:$command', upload: false); // FlutterBuglyPlugin.reportException(exceptionName: '蓝牙连接成功', reason: '蓝牙连接成功,发送开锁指令'); IoSenderManage.senderOpenLock( lockID: BlueManage().connectDeviceName, @@ -513,18 +510,14 @@ class LockDetailLogic extends BaseGetXController { signKey: signKeyDataList, privateKey: getPrivateKeyList, ); - } else if (deviceConnectionState == - BluetoothConnectionState.disconnected) { + } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { cancelBlueConnetctToastTimer(); BuglyTool.uploadException( - message: '蓝牙连接失败-开锁失败', - detail: '蓝牙连接失败,断开连接, 开锁失败--OpenLockCommand:$command', - upload: true); + message: '蓝牙连接失败-开锁失败', detail: '蓝牙连接失败,断开连接, 开锁失败--OpenLockCommand:$command', upload: true); final String getMobile = (await Storage.getMobile())!; ApmHelper.instance.trackEvent('open_lock', { 'lock_name': state.keyInfos.value.lockName!, - 'account': - getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!, + 'account': getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!, 'date': DateTool().getNowDateWithType(1), 'open_lock_result': '断开连接', }); @@ -542,7 +535,7 @@ class LockDetailLogic extends BaseGetXController { //顺便清除倒计时 closeLuckStatus(); cancelBlueConnetctToastTimer(); - await BlueManage().disconnect(); + // await BlueManage().disconnect(); } // 查询事件记录(时间查询) @@ -552,23 +545,17 @@ class LockDetailLogic extends BaseGetXController { action: () { blueManageDisconnect(); }); - BlueManage().blueSendData(BlueManage().connectDeviceName, - (BluetoothConnectionState connectionState) async { - AppLog.log( - '开始发送同步锁记录命令,蓝牙状态是否链接:${connectionState == BluetoothConnectionState.connected}'); + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + AppLog.log('开始发送同步锁记录命令,蓝牙状态是否链接:${connectionState == BluetoothConnectionState.connected}'); if (connectionState == BluetoothConnectionState.connected) { - final List? privateKey = - await Storage.getStringList(saveBluePrivateKey); - final List getPrivateKeyList = - changeStringListToIntList(privateKey!); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); final List? token = await Storage.getStringList(saveBlueToken); final List getTokenList = changeStringListToIntList(token!); - final List? publicKey = - await Storage.getStringList(saveBluePublicKey); - final List getPublicKeyList = - changeStringListToIntList(publicKey!); + final List? publicKey = await Storage.getStringList(saveBluePublicKey); + final List getPublicKeyList = changeStringListToIntList(publicKey!); AppLog.log('发送同步锁记录命令:${BlueManage().connectDeviceName}'); IoSenderManage.senderReferEventRecordTimeCommand( @@ -589,11 +576,9 @@ class LockDetailLogic extends BaseGetXController { // 从服务器获取锁的时间 开锁时传入 Future getServerDatetime() async { - final GetServerDatetimeEntity entity = - await ApiRepository.to.getServerDatetimeData(isUnShowLoading: true); + final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData(isUnShowLoading: true); if (entity.errorCode!.codeIsSuccessful) { - state.differentialTime = entity.data!.date! ~/ 1000 - - DateTime.now().millisecondsSinceEpoch ~/ 1000; + state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000; } else { state.isHaveNetwork = false; } @@ -601,8 +586,7 @@ class LockDetailLogic extends BaseGetXController { int getUTCNetTime() { if (state.isHaveNetwork) { - return DateTime.now().millisecondsSinceEpoch ~/ 1000 + - state.differentialTime; + return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime; } else { return 0; } @@ -610,15 +594,13 @@ class LockDetailLogic extends BaseGetXController { // 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口 Future getLockNetToken() async { - final LockNetTokenEntity entity = await ApiRepository.to - .getLockNetToken(lockId: state.keyInfos.value.lockId!); + final LockNetTokenEntity entity = await ApiRepository.to.getLockNetToken(lockId: state.keyInfos.value.lockId!); if (entity.errorCode!.codeIsSuccessful) { state.lockNetToken = entity.data!.token!.toString(); // AppLog.log('从服务器获取联网token:${state.lockNetToken}'); openDoorAction(); } else { - BuglyTool.uploadException( - message: '点击了需要联网开锁', detail: '点击了需要联网开锁 获取连网token失败', upload: true); + BuglyTool.uploadException(message: '点击了需要联网开锁', detail: '点击了需要联网开锁 获取连网token失败', upload: true); showToast('网络访问失败,请检查网络是否正常'.tr, something: () { resetOpenDoorState(); cancelBlueConnetctToastTimer(); @@ -630,13 +612,11 @@ class LockDetailLogic extends BaseGetXController { //电量更新请求 Future uploadElectricQuantityRequest() async { - final UploadElectricQuantityEntity entity = await ApiRepository.to - .uploadElectricQuantity( - electricQuantity: state.electricQuantity.value.toString(), - electricQuantityStandby: - state.electricQuantityStandby.value.toString(), - lockId: state.keyInfos.value.lockId.toString(), - isUnShowLoading: true); + final UploadElectricQuantityEntity entity = await ApiRepository.to.uploadElectricQuantity( + electricQuantity: state.electricQuantity.value.toString(), + electricQuantityStandby: state.electricQuantityStandby.value.toString(), + lockId: state.keyInfos.value.lockId.toString(), + isUnShowLoading: true); if (entity.errorCode!.codeIsSuccessful) { SchedulerBinding.instance.addPostFrameCallback((_) { eventBus.fire(RefreshLockListInfoDataEvent(isUnShowLoading: true)); @@ -647,8 +627,7 @@ class LockDetailLogic extends BaseGetXController { // 查询锁记录最后时间 Future getLockRecordLastUploadDataTime() async { final LockOperatingRecordGetLastRecordTimeEntity entity = - await ApiRepository.to.getLockRecordLastUploadDataTime( - lockId: state.keyInfos.value.lockId.toString()); + await ApiRepository.to.getLockRecordLastUploadDataTime(lockId: state.keyInfos.value.lockId.toString()); AppLog.log('开始获取服务端所记录更新时间:${entity}'); if (entity.errorCode!.codeIsSuccessful) { state.operateDate = entity.data!.operateDate! ~/ 1000; @@ -664,13 +643,11 @@ class LockDetailLogic extends BaseGetXController { if (list.isEmpty) { return; } - final KeyOperationRecordEntity entity = await ApiRepository.to - .lockRecordUploadData( - lockId: state.keyInfos.value.lockId.toString(), records: list); + final KeyOperationRecordEntity entity = + await ApiRepository.to.lockRecordUploadData(lockId: state.keyInfos.value.lockId.toString(), records: list); if (entity.errorCode!.codeIsSuccessful) { // mockNetworkDataRequest(); - AppLog.log( - 'state.keyInfos.value.keyType:${state.keyInfos.value.keyType}'); + AppLog.log('state.keyInfos.value.keyType:${state.keyInfos.value.keyType}'); if (state.keyInfos.value.keyType == XSConstantMacro.keyTypeOnce) { // 单次删除 deletKeyData(); @@ -680,9 +657,8 @@ class LockDetailLogic extends BaseGetXController { // 普通用户或者授权管理员删除钥匙 Future deletKeyData() async { - final ElectronicKeyListEntity entity = await ApiRepository.to - .deleteElectronicKey( - keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0); + final ElectronicKeyListEntity entity = + await ApiRepository.to.deleteElectronicKey(keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0); if (entity.errorCode!.codeIsSuccessful) { BlueManage().connectDeviceMacAddress = ''; SchedulerBinding.instance.addPostFrameCallback((_) { @@ -696,8 +672,7 @@ class LockDetailLogic extends BaseGetXController { Future remoteOpenLock() async { final catEyeConfig = state.keyInfos.value.lockSetting?.catEyeConfig ?? []; // 支持猫眼功能时,才需要判断是否是省电模式 - if (state.keyInfos.value.lockFeature?.isSupportCatEye == 1 && - catEyeConfig[0].catEyeMode == 0) { + if (state.keyInfos.value.lockFeature?.isSupportCatEye == 1 && catEyeConfig[0].catEyeMode == 0) { showToast('猫眼设置为省电模式时无法进行远程开锁,请在猫眼设置中切换为其他模式'.tr); return; } @@ -713,20 +688,17 @@ class LockDetailLogic extends BaseGetXController { /// 锁设置里面开启关闭考勤刷新锁详情 void initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction() { // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus - state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent = - eventBus - .on() - .listen((LockSetChangeSetRefreshLockDetailWithType event) { + state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent = eventBus + .on() + .listen((LockSetChangeSetRefreshLockDetailWithType event) { if (event.type == 0) { // 0考勤 state.isAttendance.value = int.parse(event.setResult); - state.keyInfos.value.lockSetting!.attendance = - int.parse(event.setResult); + state.keyInfos.value.lockSetting!.attendance = int.parse(event.setResult); } else if (event.type == 1) { // 1 开锁时是否需联网 state.isOpenLockNeedOnline.value = int.parse(event.setResult); - state.keyInfos.value.lockSetting!.appUnlockOnline = - int.parse(event.setResult); + state.keyInfos.value.lockSetting!.appUnlockOnline = int.parse(event.setResult); state.lockNetToken = ''; // 改变开锁时是否联网状态的时候清空token } else if (event.type == 2) { // 2 常开模式 @@ -741,16 +713,13 @@ class LockDetailLogic extends BaseGetXController { // 4 更新了电量 // state.electricQuantity.value = int.parse(event.setResult); // state.keyInfos.value.electricQuantity = int.parse(event.setResult); - final int electricQuantity = - int.tryParse(event.setResult['electricQuantity']) ?? 0; + final int electricQuantity = int.tryParse(event.setResult['electricQuantity']) ?? 0; state.electricQuantity.value = electricQuantity; state.keyInfos.value.electricQuantity = electricQuantity; - state.keyInfos.value.electricQuantityDate = - event.setResult['uploadElectricQuantityDate']; + state.keyInfos.value.electricQuantityDate = event.setResult['uploadElectricQuantityDate']; } else if (event.type == 5) { // 5 远程开锁 - state.keyInfos.value.lockSetting!.remoteUnlock = - int.parse(event.setResult); + state.keyInfos.value.lockSetting!.remoteUnlock = int.parse(event.setResult); } CommonDataManage().currentKeyInfo = state.keyInfos.value; eventBus.fire(RefreshLockDetailInfoDataEvent()); @@ -759,18 +728,14 @@ class LockDetailLogic extends BaseGetXController { String getKeyStatusTextAndShow() { String text = ''; - if (state.keyInfos.value.keyStatus == - XSConstantMacro.keyStatusWaitIneffective || + if (state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusWaitIneffective || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) { - text = - "${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}"; + text = "${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}"; } else { - text = state.isOpenPassageMode.value == 1 - ? '常开模式启动!长按闭锁'.tr - : '点击开锁,长按闭锁'.tr; + text = state.isOpenPassageMode.value == 1 ? '常开模式启动!长按闭锁'.tr : '点击开锁,长按闭锁'.tr; } return text; } @@ -813,9 +778,7 @@ class LockDetailLogic extends BaseGetXController { void sendMonitorMessage() async { final catEyeConfig = state.keyInfos.value.lockSetting?.catEyeConfig ?? []; final network = state.keyInfos.value.network; - if (catEyeConfig.isNotEmpty && - catEyeConfig.length > 0 && - catEyeConfig[0].catEyeMode != 0) { + if (catEyeConfig.isNotEmpty && catEyeConfig.length > 0 && catEyeConfig[0].catEyeMode != 0) { if (network == null || network?.peerId == null || network?.peerId == '') { showToast('设备未配网'.tr); return; @@ -823,8 +786,7 @@ class LockDetailLogic extends BaseGetXController { // 重置丢包率监控 // PacketLossStatistics().reset(); // 发送监控id - StartChartManage() - .startCallRequestMessageTimer(ToPeerId: network!.peerId ?? ''); + StartChartManage().startCallRequestMessageTimer(ToPeerId: network!.peerId ?? ''); } else { showToast('猫眼设置为省电模式时无法进行监控,请在猫眼设置中切换为其他模式'.tr); } @@ -849,24 +811,20 @@ class LockDetailLogic extends BaseGetXController { //更新 开锁时是否需联网 状态 if (event.type == 1) { state.isOpenLockNeedOnline.value = int.parse(event.setResult); - state.keyInfos.value.lockSetting!.appUnlockOnline = - int.parse(event.setResult); + state.keyInfos.value.lockSetting!.appUnlockOnline = int.parse(event.setResult); state.isOpenLockNeedOnline.refresh(); } if (event.type == 4) { - final int electricQuantity = - int.tryParse(event.setResult['electricQuantity']) ?? 0; + final int electricQuantity = int.tryParse(event.setResult['electricQuantity']) ?? 0; state.electricQuantity.value = electricQuantity; state.keyInfos.value.electricQuantity = electricQuantity; - state.keyInfos.value.electricQuantityDate = - event.setResult['uploadElectricQuantityDate'] ?? 0; + state.keyInfos.value.electricQuantityDate = event.setResult['uploadElectricQuantityDate'] ?? 0; state.keyInfos.refresh(); } }); - state.DetailLockInfo = eventBus - .on() - .listen((PassCurrentLockInformationEvent event) { + state.DetailLockInfo = + eventBus.on().listen((PassCurrentLockInformationEvent event) { // 提取重复表达式为局部变量,避免多次解包 final lockSettingInfo = event.lockSetInfoData.lockSettingInfo; final lockBasicInfo = event.lockSetInfoData.lockBasicInfo; @@ -879,12 +837,9 @@ class LockDetailLogic extends BaseGetXController { } // 检查前置条件:事件数据有效且 catEyeConfig 非空且非空列表 - if (lockSettingInfo != null && - targetCatEyeConfig != null && - targetCatEyeConfig.isNotEmpty) { + if (lockSettingInfo != null && targetCatEyeConfig != null && targetCatEyeConfig.isNotEmpty) { // 当前状态的 catEyeConfig - final stateCatEyeConfig = - state.keyInfos.value.lockSetting?.catEyeConfig; + final stateCatEyeConfig = state.keyInfos.value.lockSetting?.catEyeConfig; // 如果状态中的 catEyeConfig 为空或空列表,则初始化默认配置 if (stateCatEyeConfig == null || stateCatEyeConfig.isEmpty) { @@ -905,8 +860,7 @@ class LockDetailLogic extends BaseGetXController { } // 更新 catEyeMode,使用空值合并提供默认值 1 - state.keyInfos.value.lockSetting!.catEyeConfig![0].catEyeMode = - targetCatEyeConfig[0].catEyeMode ?? 1; + state.keyInfos.value.lockSetting!.catEyeConfig![0].catEyeMode = targetCatEyeConfig[0].catEyeMode ?? 1; // 刷新状态 state.keyInfos.refresh(); @@ -920,4 +874,669 @@ class LockDetailLogic extends BaseGetXController { // requestDeviceNetworkInfo(); // }); } + + // 锁数据上传服务器 + Future _lockDataUpload({required int uploadType, required int recordType, required List records}) async { + // 打印一下参数 + print('uploadType:${uploadType} recordType:${recordType} records:${records}'); + + // 无论records是否为空都继续执行,并且不提示错误 + await ApiRepository.to.lockDataUpload( + lockId: CommonDataManage().currentKeyInfo.lockId!, + uploadType: uploadType, + recordType: recordType, + records: records, + isUnShowLoading: true, + isShowNetworkErrorMsg: false, + ); + // 成功或失败都继续执行下一个步骤,不提示错误 + if (uploadType == 1) { + // 1设置 + state.indexCount.value = 0; + } else { + // 2开门方式 + switch (recordType) { + case 2: + // 密码上传成功之后,获取卡列表 + _handleGetLockCardData(); + break; + case 3: + // IC卡上传成功,获取指纹列表 + _handleGetLockFingerprintData(); + break; + case 4: + // 指纹上传成功,获取人脸列表 + _handleGetLockFaceData(); + break; + case 5: + // 人脸上传成功,获取掌静脉列表 + _handleGetLockPalmVeinData(); + break; + case 6: + // 掌静脉上传成功,获取锁遥控 + _handleGetLockRemoteControlData(); + break; + default: + break; + } + } + } + + void _handleSynchronizeUploadLockData() { + // 从获取密码开始,获取密码成功后,在成功处再次获取卡片 + _handleGetLockPasswordData(); + } + + void _handleGetLockPasswordData() { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); + + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.updataLockPasswordListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadPasswordPage, + countReq: state.countReq, + token: getTokenList, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList); + } + }); + } + + // 上传数据获取锁密码列表 + Future _replyUpdataLockPasswordListReply(Reply reply) async { + final int status = reply.data[2]; + switch (status) { + case 0x00: + final int dataLength = reply.data[8]; + state.uploadPasswordDataList.addAll(reply.data.sublist(9, reply.data.length)); + if (dataLength == 10) { + // 当数据是10的时候继续请求 + state.uploadPasswordPage = state.uploadPasswordPage + 1; + final List token = reply.data.sublist(3, 7); + showEasyLoading(); + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + IoSenderManage.updataLockPasswordListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadPasswordPage, + countReq: state.countReq, + token: token, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + } else { + state.indexCount.value = state.indexCount.value + 1; + // 保存到服务器 + _lockDataUpload( + uploadType: 2, + recordType: 2, + records: state.uploadPasswordDataList, + ); + } + break; + case 0x06: + //无权限 + final List token = reply.data.sublist(3, 7); + final List saveStrList = changeIntListToStringList(token); + Storage.setStringList(saveBlueToken, saveStrList); + + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + IoSenderManage.updataLockPasswordListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadPasswordPage, + countReq: state.countReq, + token: token, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + break; + default: + dismissEasyLoading(); + state.indexCount.value = 0; + cancelBlueConnetctToastTimer(); + break; + } + } + + void _handleGetLockCardData() { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); + + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.updataLockCardListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadCardPage, + countReq: state.countReq, + token: getTokenList, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + } + + // 上传数据获取锁卡列表 + Future _replyUpdataLockCardListReply(Reply reply) async { + final int status = reply.data[2]; + switch (status) { + case 0x00: + //成功 + cancelBlueConnetctToastTimer(); + + final int dataLength = reply.data[8]; + state.uploadCardDataList.addAll(reply.data.sublist(9, reply.data.length)); + if (dataLength == 10) { + // 当数据是10的时候继续请求 + state.uploadCardPage = state.uploadCardPage + 1; + + final List token = reply.data.sublist(3, 7); + + showEasyLoading(); + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.updataLockCardListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadCardPage, + countReq: state.countReq, + token: token, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + } else { + state.indexCount.value = state.indexCount.value + 1; + print('到达上传锁卡,${state.uploadCardDataList}'); + _lockDataUpload(uploadType: 2, recordType: 3, records: state.uploadCardDataList); + } + break; + case 0x06: + //无权限 + final List token = reply.data.sublist(3, 7); + final List saveStrList = changeIntListToStringList(token); + Storage.setStringList(saveBlueToken, saveStrList); + + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.updataLockCardListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadCardPage, + countReq: state.countReq, + token: token, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + break; + default: + dismissEasyLoading(); + state.indexCount.value = 0; + cancelBlueConnetctToastTimer(); + break; + } + } + + void _handleGetLockFingerprintData() { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); + + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.updataLockFingerprintListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadFingerprintPage, + countReq: state.countReq, + token: getTokenList, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + } + + // 上传数据获取锁指纹列表 + Future _replyUpdataLockFingerprintListReply(Reply reply) async { + final int status = reply.data[2]; + switch (status) { + case 0x00: + //成功 + cancelBlueConnetctToastTimer(); + + final int dataLength = reply.data[8]; + state.uploadFingerprintDataList.addAll(reply.data.sublist(9, reply.data.length)); + if (dataLength == 10) { + // 当数据是10的时候继续请求 + state.uploadFingerprintPage = state.uploadFingerprintPage + 1; + + final List token = reply.data.sublist(3, 7); + + showEasyLoading(); + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.updataLockFingerprintListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadFingerprintPage, + countReq: state.countReq, + token: token, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + } else { + state.indexCount.value = state.indexCount.value + 1; + _lockDataUpload(uploadType: 2, recordType: 4, records: state.uploadFingerprintDataList); + } + break; + case 0x06: + //无权限 + final List token = reply.data.sublist(3, 7); + final List saveStrList = changeIntListToStringList(token); + Storage.setStringList(saveBlueToken, saveStrList); + + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.updataLockFingerprintListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadFingerprintPage, + countReq: state.countReq, + token: token, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + break; + default: + dismissEasyLoading(); + state.indexCount.value = 0; + cancelBlueConnetctToastTimer(); + break; + } + } + + void _handleGetLockFaceData() { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); + + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.updataLockFaceListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadFacePage, + countReq: state.countReq, + token: getTokenList, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + } + + void _handleGetLockPalmVeinData() { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); + + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.updataLockPalmVeinListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadPalmVeinPage, + countReq: state.countReq, + token: getTokenList, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + } + + void _handleGetLockRemoteControlData() { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); + + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.updataLockRemoteControlListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadRemoteControlPage, + countReq: state.countReq, + token: getTokenList, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + } + + Future _replyUpdataLockFaceListReply(Reply reply) async { + final int status = reply.data[2]; + switch (status) { + case 0x00: + //成功 + cancelBlueConnetctToastTimer(); + + final int dataLength = reply.data[8]; + state.uploadFaceDataList.addAll(reply.data.sublist(9, reply.data.length)); + if (dataLength == 10) { + // 当数据是10的时候继续请求 + state.uploadFacePage = state.uploadFacePage + 1; + + final List token = reply.data.sublist(3, 7); + + showEasyLoading(); + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.updataLockFaceListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadFacePage, + countReq: state.countReq, + token: token, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + } else { + state.indexCount.value = state.indexCount.value + 1; + _lockDataUpload(uploadType: 2, recordType: 5, records: state.uploadFaceDataList); + } + break; + case 0x06: + //无权限 + final List token = reply.data.sublist(3, 7); + final List saveStrList = changeIntListToStringList(token); + Storage.setStringList(saveBlueToken, saveStrList); + + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.updataLockFaceListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadFacePage, + countReq: state.countReq, + token: token, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + break; + default: + dismissEasyLoading(); + state.indexCount.value = 0; + cancelBlueConnetctToastTimer(); + break; + } + } + + // 上传数据获取锁掌静脉列表解析 + Future _replyUpdataLockPalmVeinListReply(Reply reply) async { + final int status = reply.data[2]; + switch (status) { + case 0x00: + //成功 + cancelBlueConnetctToastTimer(); + + final int dataLength = reply.data[8]; + state.uploadPalmVeinDataList.addAll(reply.data.sublist(9, reply.data.length)); + if (dataLength == 10) { + // 当数据是10的时候继续请求 + state.uploadPalmVeinPage = state.uploadPalmVeinPage + 1; + + final List token = reply.data.sublist(3, 7); + + showEasyLoading(); + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.updataLockPalmVeinListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadPalmVeinPage, + countReq: state.countReq, + token: token, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + } else { + state.indexCount.value = state.indexCount.value + 1; + _lockDataUpload(uploadType: 2, recordType: 6, records: state.uploadPalmVeinDataList); + } + break; + case 0x06: + //无权限 + final List token = reply.data.sublist(3, 7); + final List saveStrList = changeIntListToStringList(token); + Storage.setStringList(saveBlueToken, saveStrList); + + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.updataLockPalmVeinListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadPalmVeinPage, + countReq: state.countReq, + token: token, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + break; + default: + dismissEasyLoading(); + state.indexCount.value = 0; + cancelBlueConnetctToastTimer(); + break; + } + } + + // 上传数据获取锁遥控列表解析 + Future _replyUpdataLockRemoteControlListReply(Reply reply) async { + final int status = reply.data[2]; + switch (status) { + case 0x00: + //成功 + cancelBlueConnetctToastTimer(); + + final int dataLength = reply.data[8]; + state.uploadRemoteControlDataList.addAll(reply.data.sublist(9, reply.data.length)); + if (dataLength == 10) { + // 当数据是10的时候继续请求 + state.uploadRemoteControlPage = state.uploadRemoteControlPage + 1; + + final List token = reply.data.sublist(3, 7); + + showEasyLoading(); + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.updataLockRemoteControlListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadRemoteControlPage, + countReq: state.countReq, + token: token, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + } else { + state.indexCount.value = state.indexCount.value + 1; + _lockDataUpload(uploadType: 2, recordType: 7, records: state.uploadRemoteControlDataList); + } + break; + case 0x06: + //无权限 + final List token = reply.data.sublist(3, 7); + final List saveStrList = changeIntListToStringList(token); + Storage.setStringList(saveBlueToken, saveStrList); + + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { + if (connectionState == BluetoothConnectionState.connected) { + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); + + final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = changeStringListToIntList(signKey!); + + IoSenderManage.updataLockRemoteControlListCommand( + lockID: BlueManage().connectDeviceName, + userID: await Storage.getUid(), + page: state.uploadRemoteControlPage, + countReq: state.countReq, + token: token, + needAuthor: 1, + signKey: signKeyDataList, + privateKey: getPrivateKeyList, + ); + } + }); + break; + default: + dismissEasyLoading(); + state.indexCount.value = 0; + cancelBlueConnetctToastTimer(); + break; + } + } } diff --git a/lib/main/lockDetail/lockDetail/lockDetail_state.dart b/lib/main/lockDetail/lockDetail/lockDetail_state.dart index 44efb77d..eb4b6d30 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_state.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_state.dart @@ -58,8 +58,26 @@ class LockDetailState { int logCountPage = 10; // 蓝牙记录一页多少个 RxInt nextAuthTime = 0.obs; // 下次认证时间 - // LockDetailState() { - // Map map = Get.arguments; - // lockCount = map["lockCount"]; - // } + int countReq = 10;// 每次请求的数量 + RxInt indexCount = 0.obs;// 用来显示按钮的索引 0/5 + + int uploadPasswordPage = 0;// 上传密码的页数 + List uploadPasswordDataList = [];// 上传密码的数据 + + int uploadCardPage = 0;// 上传卡片的页数 + List uploadCardDataList = [];// 上传卡片的数据 + + int uploadFingerprintPage = 0;// 上传指纹的页数 + List uploadFingerprintDataList = [];// 上传指纹的数据 + + int uploadFacePage = 0;// 上传人脸的页数 + List uploadFaceDataList = [];// 上传人脸的数据 + + int uploadPalmVeinPage = 0;// 上传掌静脉的页数 + List uploadPalmVeinDataList = [];// 上传掌静脉的数据 + + int uploadRemoteControlPage = 0;// 上传遥控的页数 + List uploadRemoteControlDataList = [];// 上传遥控的数据 + + List uploadLockSetDataList = [];// 上传锁设置数据 } diff --git a/lib/main/lockDetail/lockSet/uploadData/uploadData_logic.dart b/lib/main/lockDetail/lockSet/uploadData/uploadData_logic.dart index e1046768..826547cf 100644 --- a/lib/main/lockDetail/lockSet/uploadData/uploadData_logic.dart +++ b/lib/main/lockDetail/lockSet/uploadData/uploadData_logic.dart @@ -29,49 +29,41 @@ class UploadDataLogic extends BaseGetXController { // 监听蓝牙协议返回结果 late StreamSubscription _replySubscription; + void _initReplySubscription() { - _replySubscription = - EventBusManager().eventBus!.on().listen((Reply reply) async { + _replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) async { // 上传数据获取锁密码列表 - if (reply is UpdataLockPasswordListReply && - (state.ifCurrentScreen.value == true)) { + if (reply is UpdataLockPasswordListReply && (state.ifCurrentScreen.value == true)) { _replyUpdataLockPasswordListReply(reply); } // 上传数据获取锁卡列表 - if (reply is UpdataLockCardListReply && - (state.ifCurrentScreen.value == true)) { + if (reply is UpdataLockCardListReply && (state.ifCurrentScreen.value == true)) { _replyUpdataLockCardListReply(reply); } // 上传数据获取锁指纹列表 - if (reply is UpdataLockFingerprintListReply && - (state.ifCurrentScreen.value == true)) { + if (reply is UpdataLockFingerprintListReply && (state.ifCurrentScreen.value == true)) { _replyUpdataLockFingerprintListReply(reply); } // 上传数据获取锁人脸列表 - if (reply is UpdataLockFaceListReply && - (state.ifCurrentScreen.value == true)) { + if (reply is UpdataLockFaceListReply && (state.ifCurrentScreen.value == true)) { _replyUpdataLockFaceListReply(reply); } // 上传数据获取锁掌静脉列表 - if (reply is UpdataLockPalmVeinListReply && - (state.ifCurrentScreen.value == true)) { + if (reply is UpdataLockPalmVeinListReply && (state.ifCurrentScreen.value == true)) { _replyUpdataLockPalmVeinListReply(reply); } // 上传数据获取锁遥控 - if (reply is UpdataLockRemoteControlListReply && - (state.ifCurrentScreen.value == true)) { + if (reply is UpdataLockRemoteControlListReply && (state.ifCurrentScreen.value == true)) { _replyUpdataLockRemoteControlListReply(reply); } // 上传数据获取锁设置 - if (reply is UpdataLockSetReply && - (state.ifCurrentScreen.value == true) && - (state.ifSeletUpdataBtnState == true)) { + if (reply is UpdataLockSetReply && (state.ifCurrentScreen.value == true) && (state.ifSeletUpdataBtnState == true)) { _replyUpdataLockSetReply(reply); } }); @@ -86,8 +78,7 @@ class UploadDataLogic extends BaseGetXController { cancelBlueConnetctToastTimer(); final int dataLength = reply.data[8]; - state.uploadPasswordDataList - .addAll(reply.data.sublist(9, reply.data.length)); + state.uploadPasswordDataList.addAll(reply.data.sublist(9, reply.data.length)); if (dataLength == 10) { // 当数据是10的时候继续请求 state.uploadPasswordPage = state.uploadPasswordPage + 1; @@ -105,10 +96,7 @@ class UploadDataLogic extends BaseGetXController { // }else{ // // 如果不是空的解析数据上传 state.indexCount.value = state.indexCount.value + 1; - _lockDataUpload( - uploadType: 2, - recordType: 2, - records: state.uploadPasswordDataList); + _lockDataUpload(uploadType: 2, recordType: 2, records: state.uploadPasswordDataList); // } } break; @@ -139,8 +127,7 @@ class UploadDataLogic extends BaseGetXController { cancelBlueConnetctToastTimer(); final int dataLength = reply.data[8]; - state.uploadCardDataList - .addAll(reply.data.sublist(9, reply.data.length)); + state.uploadCardDataList.addAll(reply.data.sublist(9, reply.data.length)); if (dataLength == 10) { // 当数据是10的时候继续请求 state.uploadCardPage = state.uploadCardPage + 1; @@ -157,8 +144,7 @@ class UploadDataLogic extends BaseGetXController { // }else{ // // 如果不是空的解析数据上传 state.indexCount.value = state.indexCount.value + 1; - _lockDataUpload( - uploadType: 2, recordType: 3, records: state.uploadCardDataList); + _lockDataUpload(uploadType: 2, recordType: 3, records: state.uploadCardDataList); // } } break; @@ -188,8 +174,7 @@ class UploadDataLogic extends BaseGetXController { cancelBlueConnetctToastTimer(); final int dataLength = reply.data[8]; - state.uploadFingerprintDataList - .addAll(reply.data.sublist(9, reply.data.length)); + state.uploadFingerprintDataList.addAll(reply.data.sublist(9, reply.data.length)); if (dataLength == 10) { // 当数据是10的时候继续请求 state.uploadFingerprintPage = state.uploadFingerprintPage + 1; @@ -206,10 +191,7 @@ class UploadDataLogic extends BaseGetXController { // }else{ // // 如果不是空的解析数据上传 state.indexCount.value = state.indexCount.value + 1; - _lockDataUpload( - uploadType: 2, - recordType: 4, - records: state.uploadFingerprintDataList); + _lockDataUpload(uploadType: 2, recordType: 4, records: state.uploadFingerprintDataList); // } } break; @@ -239,8 +221,7 @@ class UploadDataLogic extends BaseGetXController { cancelBlueConnetctToastTimer(); final int dataLength = reply.data[8]; - state.uploadFaceDataList - .addAll(reply.data.sublist(9, reply.data.length)); + state.uploadFaceDataList.addAll(reply.data.sublist(9, reply.data.length)); if (dataLength == 10) { // 当数据是10的时候继续请求 state.uploadFacePage = state.uploadFacePage + 1; @@ -257,8 +238,7 @@ class UploadDataLogic extends BaseGetXController { // }else{ // 如果不是空的解析数据上传 state.indexCount.value = state.indexCount.value + 1; - _lockDataUpload( - uploadType: 2, recordType: 5, records: state.uploadFaceDataList); + _lockDataUpload(uploadType: 2, recordType: 5, records: state.uploadFaceDataList); // } } break; @@ -288,8 +268,7 @@ class UploadDataLogic extends BaseGetXController { cancelBlueConnetctToastTimer(); final int dataLength = reply.data[8]; - state.uploadPalmVeinDataList - .addAll(reply.data.sublist(9, reply.data.length)); + state.uploadPalmVeinDataList.addAll(reply.data.sublist(9, reply.data.length)); if (dataLength == 10) { // 当数据是10的时候继续请求 state.uploadPalmVeinPage = state.uploadPalmVeinPage + 1; @@ -306,10 +285,7 @@ class UploadDataLogic extends BaseGetXController { // }else{ // // 如果不是空的解析数据上传 state.indexCount.value = state.indexCount.value + 1; - _lockDataUpload( - uploadType: 2, - recordType: 6, - records: state.uploadPalmVeinDataList); + _lockDataUpload(uploadType: 2, recordType: 6, records: state.uploadPalmVeinDataList); // } } break; @@ -339,8 +315,7 @@ class UploadDataLogic extends BaseGetXController { cancelBlueConnetctToastTimer(); final int dataLength = reply.data[8]; - state.uploadRemoteControlDataList - .addAll(reply.data.sublist(9, reply.data.length)); + state.uploadRemoteControlDataList.addAll(reply.data.sublist(9, reply.data.length)); if (dataLength == 10) { // 当数据是10的时候继续请求 state.uploadRemoteControlPage = state.uploadRemoteControlPage + 1; @@ -357,10 +332,7 @@ class UploadDataLogic extends BaseGetXController { // }else{ // // 如果不是空的解析数据上传 state.indexCount.value = state.indexCount.value + 1; - _lockDataUpload( - uploadType: 2, - recordType: 7, - records: state.uploadRemoteControlDataList); + _lockDataUpload(uploadType: 2, recordType: 7, records: state.uploadRemoteControlDataList); // } } break; @@ -390,10 +362,8 @@ class UploadDataLogic extends BaseGetXController { state.indexCount.value = state.indexCount.value + 1; cancelBlueConnetctToastTimer(); - state.uploadLockSetDataList - .addAll(reply.data.sublist(7, reply.data.length)); - _lockDataUpload( - uploadType: 1, recordType: 0, records: state.uploadLockSetDataList); + state.uploadLockSetDataList.addAll(reply.data.sublist(7, reply.data.length)); + _lockDataUpload(uploadType: 1, recordType: 0, records: state.uploadLockSetDataList); break; case 0x06: //无权限 @@ -418,22 +388,18 @@ class UploadDataLogic extends BaseGetXController { return; } state.sureBtnState.value = 1; - showEasyLoading(); showBlueConnetctToastTimer(action: () { dismissEasyLoading(); - AppLog.log('上传密码列表获取超时 关闭加载菊花'); state.sureBtnState.value = 0; }); - BlueManage().blueSendData(BlueManage().connectDeviceName, - (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { final List? token = await Storage.getStringList(saveBlueToken); final List getTokenList = changeStringListToIntList(token!); updataLockPasswordList(getTokenList, state.uploadPasswordPage); } else if (connectionState == BluetoothConnectionState.disconnected) { - AppLog.log('上传密码列表连接失败 关闭加载菊花'); dismissEasyLoading(); cancelBlueConnetctToastTimer(); state.sureBtnState.value = 0; @@ -446,8 +412,7 @@ class UploadDataLogic extends BaseGetXController { // 公共的获取密码列表 Future updataLockPasswordList(List token, int page) async { - final List? privateKey = - await Storage.getStringList(saveBluePrivateKey); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); final List getPrivateKeyList = changeStringListToIntList(privateKey!); final List? signKey = await Storage.getStringList(saveBlueSignKey); @@ -472,8 +437,7 @@ class UploadDataLogic extends BaseGetXController { state.indexCount.value = 0; state.sureBtnState.value = 0; }); - BlueManage().blueSendData(BlueManage().connectDeviceName, - (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { final List? token = await Storage.getStringList(saveBlueToken); final List getTokenList = changeStringListToIntList(token!); @@ -493,8 +457,7 @@ class UploadDataLogic extends BaseGetXController { // 公共的获取Card列表 Future updataLockCardList(List token, int page) async { - final List? privateKey = - await Storage.getStringList(saveBluePrivateKey); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); final List getPrivateKeyList = changeStringListToIntList(privateKey!); final List? signKey = await Storage.getStringList(saveBlueSignKey); @@ -519,8 +482,7 @@ class UploadDataLogic extends BaseGetXController { state.indexCount.value = 0; state.sureBtnState.value = 0; }); - BlueManage().blueSendData(BlueManage().connectDeviceName, - (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { final List? token = await Storage.getStringList(saveBlueToken); final List getTokenList = changeStringListToIntList(token!); @@ -540,8 +502,7 @@ class UploadDataLogic extends BaseGetXController { // 公共的获取指纹列表 Future updataLockFingerprintList(List token, int page) async { - final List? privateKey = - await Storage.getStringList(saveBluePrivateKey); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); final List getPrivateKeyList = changeStringListToIntList(privateKey!); final List? signKey = await Storage.getStringList(saveBlueSignKey); @@ -566,8 +527,7 @@ class UploadDataLogic extends BaseGetXController { state.indexCount.value = 0; state.sureBtnState.value = 0; }); - BlueManage().blueSendData(BlueManage().connectDeviceName, - (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { final List? token = await Storage.getStringList(saveBlueToken); final List getTokenList = changeStringListToIntList(token!); @@ -587,8 +547,7 @@ class UploadDataLogic extends BaseGetXController { // 公共的获取人脸列表 Future updataLockFaceList(List token, int page) async { - final List? privateKey = - await Storage.getStringList(saveBluePrivateKey); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); final List getPrivateKeyList = changeStringListToIntList(privateKey!); final List? signKey = await Storage.getStringList(saveBlueSignKey); @@ -613,8 +572,7 @@ class UploadDataLogic extends BaseGetXController { state.indexCount.value = 0; state.sureBtnState.value = 0; }); - BlueManage().blueSendData(BlueManage().connectDeviceName, - (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { final List? token = await Storage.getStringList(saveBlueToken); final List getTokenList = changeStringListToIntList(token!); @@ -634,8 +592,7 @@ class UploadDataLogic extends BaseGetXController { // 公共的获取掌静脉列表 Future updataLockPalmVeinList(List token, int page) async { - final List? privateKey = - await Storage.getStringList(saveBluePrivateKey); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); final List getPrivateKeyList = changeStringListToIntList(privateKey!); final List? signKey = await Storage.getStringList(saveBlueSignKey); @@ -660,14 +617,12 @@ class UploadDataLogic extends BaseGetXController { state.indexCount.value = 0; state.sureBtnState.value = 0; }); - BlueManage().blueSendData(BlueManage().connectDeviceName, - (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { final List? token = await Storage.getStringList(saveBlueToken); final List getTokenList = changeStringListToIntList(token!); - updataLockRemoteControlList( - getTokenList, state.uploadRemoteControlPage); + updataLockRemoteControlList(getTokenList, state.uploadRemoteControlPage); } else if (connectionState == BluetoothConnectionState.disconnected) { dismissEasyLoading(); cancelBlueConnetctToastTimer(); @@ -682,8 +637,7 @@ class UploadDataLogic extends BaseGetXController { // 公共的获取遥控列表 Future updataLockRemoteControlList(List token, int page) async { - final List? privateKey = - await Storage.getStringList(saveBluePrivateKey); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); final List getPrivateKeyList = changeStringListToIntList(privateKey!); final List? signKey = await Storage.getStringList(saveBlueSignKey); @@ -708,8 +662,7 @@ class UploadDataLogic extends BaseGetXController { state.indexCount.value = 0; state.sureBtnState.value = 0; }); - BlueManage().blueSendData(BlueManage().connectDeviceName, - (BluetoothConnectionState connectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { final List? token = await Storage.getStringList(saveBlueToken); final List getTokenList = changeStringListToIntList(token!); @@ -729,8 +682,7 @@ class UploadDataLogic extends BaseGetXController { // 公共的上传锁设置 Future updataLockSet(List token) async { - final List? privateKey = - await Storage.getStringList(saveBluePrivateKey); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); final List getPrivateKeyList = changeStringListToIntList(privateKey!); final List? signKey = await Storage.getStringList(saveBlueSignKey); @@ -746,16 +698,9 @@ class UploadDataLogic extends BaseGetXController { } // 锁数据上传服务器 - Future _lockDataUpload( - {required int uploadType, - required int recordType, - required List records}) async { + Future _lockDataUpload({required int uploadType, required int recordType, required List records}) async { final LoginEntity entity = await ApiRepository.to.lockDataUpload( - lockId: CommonDataManage().currentKeyInfo.lockId!, - uploadType: uploadType, - recordType: recordType, - records: records, - isUnShowLoading: false); + lockId: CommonDataManage().currentKeyInfo.lockId!, uploadType: uploadType, recordType: recordType, records: records, isUnShowLoading: false); if (entity.errorCode!.codeIsSuccessful) { if (uploadType == 1) { // 1设置 @@ -806,32 +751,32 @@ class UploadDataLogic extends BaseGetXController { } else { // 2开门方式 switch (recordType) { - // case 1: - // // 电子钥匙 - // - // break; + // case 1: + // // 电子钥匙 + // + // break; case 2: - // 密码上传成功之后,获取卡列表 + // 密码上传成功之后,获取卡列表 getUpdataLockCardList(); break; case 3: - // IC卡上传成功,获取指纹列表 + // IC卡上传成功,获取指纹列表 getUpdataLockFingerprintList(); break; case 4: - // 指纹上传成功,获取人脸列表 + // 指纹上传成功,获取人脸列表 getUpdataLockFaceList(); break; case 5: - // 人脸上传成功,获取掌静脉列表 + // 人脸上传成功,获取掌静脉列表 getUpdataLockPalmVeinList(); break; case 6: - // 掌静脉上传成功,获取锁遥控 + // 掌静脉上传成功,获取锁遥控 getUpdataLockRemoteControlList(); break; case 7: - // 遥控上传成功,获取锁设置 + // 遥控上传成功,获取锁设置 getUpdataLockSet(); break; default: diff --git a/lib/mine/addLock/lock_voice_setting/lock_voice_setting_logic.dart b/lib/mine/addLock/lock_voice_setting/lock_voice_setting_logic.dart index 221c9d6f..3adcc054 100644 --- a/lib/mine/addLock/lock_voice_setting/lock_voice_setting_logic.dart +++ b/lib/mine/addLock/lock_voice_setting/lock_voice_setting_logic.dart @@ -58,7 +58,7 @@ class LockVoiceSettingLogic extends BaseGetXController { handleSetResult(reply); } }); - initList(); + await initList(); readLockLanguage(); } diff --git a/lib/network/api_provider.dart b/lib/network/api_provider.dart index 69de7cb3..129b47eb 100755 --- a/lib/network/api_provider.dart +++ b/lib/network/api_provider.dart @@ -4,8 +4,8 @@ import 'package:get/get.dart'; import 'api_provider_base.dart'; class ApiProvider extends BaseProvider { - Future sendValidationCode(String countryCode, String account, - String channel, String codeType, String xWidth) => + Future sendValidationCode( + String countryCode, String account, String channel, String codeType, String xWidth) => post( sendValidationCodeUrl.toUrl, jsonEncode({ @@ -48,26 +48,22 @@ class ApiProvider extends BaseProvider { // 'verificationCode': verificationCode, // })); - Future getSliderVerifyImg(String countryCode, String account) => - post( - getSliderVerifyImgUrl.toUrl, - jsonEncode({ - 'countryCode': countryCode, - 'account': account, - })); + Future getSliderVerifyImg(String countryCode, String account) => post( + getSliderVerifyImgUrl.toUrl, + jsonEncode({ + 'countryCode': countryCode, + 'account': account, + })); - Future checkSliderVerifyImg( - String countryCode, String account, String xWidth) => - post( - checkImgUrl.toUrl, - jsonEncode({ - 'countryCode': countryCode, - 'account': account, - 'xWidth': xWidth, - })); + Future checkSliderVerifyImg(String countryCode, String account, String xWidth) => post( + checkImgUrl.toUrl, + jsonEncode({ + 'countryCode': countryCode, + 'account': account, + 'xWidth': xWidth, + })); - Future login(String loginType, String password, String countryCode, - String username, Map deviceInfo) => + Future login(String loginType, String password, String countryCode, String username, Map deviceInfo) => post( loginUrl.toUrl, jsonEncode({ @@ -80,23 +76,16 @@ class ApiProvider extends BaseProvider { 'deviceInfo': deviceInfo, })); - Future oneClickLogin( - String loginType, String loginToken, Map deviceInfo) => - post( - oneClickLoginUrl.toUrl, - jsonEncode({ - 'loginType': loginType, - 'platId': '2', - 'loginToken': loginToken, - 'deviceInfo': deviceInfo, - })); + Future oneClickLogin(String loginType, String loginToken, Map deviceInfo) => post( + oneClickLoginUrl.toUrl, + jsonEncode({ + 'loginType': loginType, + 'platId': '2', + 'loginToken': loginToken, + 'deviceInfo': deviceInfo, + })); - Future resetPassword( - String countryCode, - String account, - String date, - String newPassword, - String uniqueid, + Future resetPassword(String countryCode, String account, String date, String newPassword, String uniqueid, String verificationCode) => post( resetPasswordURL.toUrl, @@ -109,8 +98,7 @@ class ApiProvider extends BaseProvider { 'verificationCode': verificationCode, })); - Future getCountryRegion(String type) => - post(getCountryRegionURL.toUrl, jsonEncode({'type': type})); + Future getCountryRegion(String type) => post(getCountryRegionURL.toUrl, jsonEncode({'type': type})); Future electronicKeyList( String endDate, @@ -235,17 +223,8 @@ class ApiProvider extends BaseProvider { 'operatorUid': operatorUid, })); - Future updateKeyDate( - String keyId, - String lockId, - String endDate, - String startDate, - List weekDays, - int keyType, - int startTime, - int endTime, - int isOnlyManageSelf, - int remoteEnable) => + Future updateKeyDate(String keyId, String lockId, String endDate, String startDate, List weekDays, + int keyType, int startTime, int endTime, int isOnlyManageSelf, int remoteEnable) => post( updateKeyDateURL.toUrl, jsonEncode({ @@ -282,8 +261,7 @@ class ApiProvider extends BaseProvider { })); Future resetElectronicKey(String lockId, String operatorUid) => - post(resetElectronicKeyURL.toUrl, - jsonEncode({'lockId': lockId, 'operatorUid': operatorUid})); + post(resetElectronicKeyURL.toUrl, jsonEncode({'lockId': lockId, 'operatorUid': operatorUid})); Future lockRecordList( {required String lockId, @@ -320,8 +298,7 @@ class ApiProvider extends BaseProvider { })); // 门锁事件日志 - Future lockEventList(int lockId, int lockEventType, int pageNo, - int pageSize, int startDate, int endDate) => + Future lockEventList(int lockId, int lockEventType, int pageNo, int pageSize, int startDate, int endDate) => post( lockEventListURL.toUrl, jsonEncode({ @@ -379,16 +356,8 @@ class ApiProvider extends BaseProvider { isUnShowLoading: true); // 绑定蓝牙管理员 - Future bindingBlueAdmin( - String lockAlias, - Map position, - Map bluetooth, - Map lockInfo, - String lockUserNo, - String pwdTimestamp, - String featureValue, - String featureSettingValue, - List featureSettingParams) => + Future bindingBlueAdmin(String lockAlias, Map position, Map bluetooth, Map lockInfo, String lockUserNo, + String pwdTimestamp, String featureValue, String featureSettingValue, List featureSettingParams) => post( bindingBlueAdminURL.toUrl, jsonEncode({ @@ -441,13 +410,12 @@ class ApiProvider extends BaseProvider { ); // 获取所有锁设置信息 - Future getLockSettingInfoDataIsNotLoadingIcon(String lockId) => - post( - getLockSettingURL.toUrl, - jsonEncode({ - 'lockId': lockId, - }), - isUnShowLoading: true); + Future getLockSettingInfoDataIsNotLoadingIcon(String lockId) => post( + getLockSettingURL.toUrl, + jsonEncode({ + 'lockId': lockId, + }), + isUnShowLoading: true); // 删除锁 Future deletLockInfo(int lockId) => post( @@ -457,15 +425,9 @@ class ApiProvider extends BaseProvider { })); // 删除拥有的当前钥匙 - Future deletOwnerKeyInfo( - String lockId, String keyId, int includeUnderlings) => - post( - deleteElectronicKeyURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'keyId': keyId, - 'includeUnderlings': includeUnderlings - })); + Future deletOwnerKeyInfo(String lockId, String keyId, int includeUnderlings) => post( + deleteElectronicKeyURL.toUrl, + jsonEncode({'lockId': lockId, 'keyId': keyId, 'includeUnderlings': includeUnderlings})); // 检查账户密码 Future checkLoginPassword(String password) => post( @@ -478,8 +440,7 @@ class ApiProvider extends BaseProvider { Future getWifiLockServiceIpAndPort() => post(getWifiServiceIpURL.toUrl, jsonEncode({}), isUnShowLoading: true); - Future passwordKeyList(String keyStatus, String lockId, - String pageNo, String pageSize, String searchStr) => + Future passwordKeyList(String keyStatus, String lockId, String pageNo, String pageSize, String searchStr) => post( passwordKeyListURL.toUrl, jsonEncode({ @@ -494,22 +455,13 @@ class ApiProvider extends BaseProvider { int lockId, int keyboardPwdId, ) => - post(passwordKeyDetailURL.toUrl, - jsonEncode({'lockId': lockId, 'keyboardPwdId': keyboardPwdId})); + post(passwordKeyDetailURL.toUrl, jsonEncode({'lockId': lockId, 'keyboardPwdId': keyboardPwdId})); - Future resetPasswordKey(String lockId, String operatorUid) => post( - resetPasswordURL.toUrl, - jsonEncode({'lockId': lockId, 'operatorUid': operatorUid})); + Future resetPasswordKey(String lockId, String operatorUid) => + post(resetPasswordURL.toUrl, jsonEncode({'lockId': lockId, 'operatorUid': operatorUid})); - Future getKeyboardPwd( - String endDate, - String keyboardPwdName, - String keyboardPwdType, - int lockId, - String startDate, - int startHours, - int endHours, - int isCoerced) => + Future getKeyboardPwd(String endDate, String keyboardPwdName, String keyboardPwdType, int lockId, + String startDate, int startHours, int endHours, int isCoerced) => post( passwordKeyGetURL.toUrl, jsonEncode({ @@ -524,15 +476,8 @@ class ApiProvider extends BaseProvider { })); // 更新锁用户序号 - Future updatePWDNumber( - String lockId, String keyboardPwdId, String pwdUserNo) => - post( - updatePWDNumberURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'keyboardPwdId': keyboardPwdId, - 'pwdUserNo': pwdUserNo - })); + Future updatePWDNumber(String lockId, String keyboardPwdId, String pwdUserNo) => post( + updatePWDNumberURL.toUrl, jsonEncode({'lockId': lockId, 'keyboardPwdId': keyboardPwdId, 'pwdUserNo': pwdUserNo})); Future addKeyboardPwd( String lockId, @@ -558,15 +503,13 @@ class ApiProvider extends BaseProvider { })); // 自定义密码校验名字密码是否重复 - Future checkKeyboardpwdName( - String lockId, String keyboardPwdName, String keyboardPwd) => - post( - passwordKeyCheckKeyboardpwdNameURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'keyboardPwdName': keyboardPwdName, - 'keyboardPwd': keyboardPwd, - })); + Future checkKeyboardpwdName(String lockId, String keyboardPwdName, String keyboardPwd) => post( + passwordKeyCheckKeyboardpwdNameURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'keyboardPwdName': keyboardPwdName, + 'keyboardPwd': keyboardPwd, + })); Future updateKeyboardPwd( int lockId, @@ -601,21 +544,17 @@ class ApiProvider extends BaseProvider { Future clearOperationRecord(String lockId) => post(clearOperationRecordURL.toUrl, jsonEncode({'lockId': lockId})); - Future addLockGroup(String groupName, String operatorUid) => post( - addlockGroupURL.toUrl, - jsonEncode({'groupName': groupName, 'operatorUid': operatorUid})); + Future addLockGroup(String groupName, String operatorUid) => + post(addlockGroupURL.toUrl, jsonEncode({'groupName': groupName, 'operatorUid': operatorUid})); // 编辑锁名字 - Future editLockGroupRequest(int groupId, String groupName) => post( - editlockGroupURL.toUrl, - jsonEncode({'groupId': groupId, 'groupName': groupName})); + Future editLockGroupRequest(int groupId, String groupName) => + post(editlockGroupURL.toUrl, jsonEncode({'groupId': groupId, 'groupName': groupName})); - Future setLockGroup(String lockId, String groupId) => post( - setlockGroupURL.toUrl, - jsonEncode({'lockId': lockId, 'groupId': groupId})); + Future setLockGroup(String lockId, String groupId) => + post(setlockGroupURL.toUrl, jsonEncode({'lockId': lockId, 'groupId': groupId})); - Future lockGroupList(String type) => - post(lockGroupListURL.toUrl, jsonEncode({'type': type})); + Future lockGroupList(String type) => post(lockGroupListURL.toUrl, jsonEncode({'type': type})); // 删除组 Future deleteGroup(int groupId) => post( @@ -646,28 +585,21 @@ class ApiProvider extends BaseProvider { })); //APP开锁时需手机联网的锁 - Future setAppUnlockMustOnline(List lockIdList) => post( - setAppUnlockMustOnlineURL.toUrl, jsonEncode({'lockIdList': lockIdList})); + Future setAppUnlockMustOnline(List lockIdList) => + post(setAppUnlockMustOnlineURL.toUrl, jsonEncode({'lockIdList': lockIdList})); - Future deleteElectronicKey(String keyId, int includeUnderlings) => - post( - deleteElectronicKeyURL.toUrl, - jsonEncode({ - 'keyId': keyId, - 'includeUnderlings': includeUnderlings, - })); + Future deleteElectronicKey(String keyId, int includeUnderlings) => post( + deleteElectronicKeyURL.toUrl, + jsonEncode({ + 'keyId': keyId, + 'includeUnderlings': includeUnderlings, + })); Future deleteAdministrator(String uid, String includeUnderlings) => - post(deleteElectronicKeyURL.toUrl, - jsonEncode({'uid': uid, 'includeUnderlings': includeUnderlings})); + post(deleteElectronicKeyURL.toUrl, jsonEncode({'uid': uid, 'includeUnderlings': includeUnderlings})); Future updateAdministrator( - String uid, - String keyName, - String endDate, - String startDate, - int isOnlyManageSelf, - int keyType) => + String uid, String keyName, String endDate, String startDate, int isOnlyManageSelf, int keyType) => post( updateAdministratorURL.toUrl, jsonEncode({ @@ -730,13 +662,12 @@ class ApiProvider extends BaseProvider { 'pageSize': pageSize, })); - Future expireFingerprintList(String pageNo, String pageSize) => - post( - expireFingerprintListURL.toUrl, - jsonEncode({ - 'pageNo': pageNo, - 'pageSize': pageSize, - })); + Future expireFingerprintList(String pageNo, String pageSize) => post( + expireFingerprintListURL.toUrl, + jsonEncode({ + 'pageNo': pageNo, + 'pageSize': pageSize, + })); Future expireFaceList(String pageNo, String pageSize) => post( expireFaceListURL.toUrl, @@ -745,15 +676,9 @@ class ApiProvider extends BaseProvider { 'pageSize': pageSize, })); - Future deleteKeyboardPwd( - String lockId, String keyboardPwdId, int deleteType) => - post( - deleteKeyboardPwdURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'keyboardPwdId': keyboardPwdId, - 'deleteType': deleteType - })); + Future deleteKeyboardPwd(String lockId, String keyboardPwdId, int deleteType) => post( + deleteKeyboardPwdURL.toUrl, + jsonEncode({'lockId': lockId, 'keyboardPwdId': keyboardPwdId, 'deleteType': deleteType})); // Future updateSetting(String lockId, String isOn, String type) => // post(updateSettingURL.toUrl, @@ -768,15 +693,13 @@ class ApiProvider extends BaseProvider { /// 锁设置模块 // 自动闭锁 - Future setAutoUnlockLoadData( - int lockId, int autoLock, int autoLockSecond) => - post( - updateLockSettingUrl.toUrl, - jsonEncode({ - 'lockId': lockId, - 'autoLock': autoLock, - 'autoLockSecond': autoLockSecond, - })); + Future setAutoUnlockLoadData(int lockId, int autoLock, int autoLockSecond) => post( + updateLockSettingUrl.toUrl, + jsonEncode({ + 'lockId': lockId, + 'autoLock': autoLock, + 'autoLockSecond': autoLockSecond, + })); /// 更新网络信息 配网之后把网络信息提交到服务器保存 Future updateNetworkInfo(int lockId, String network) => post( @@ -787,15 +710,13 @@ class ApiProvider extends BaseProvider { })); // 锁声音 - Future setLockSoundData( - int lockId, int lockSound, int lockSoundVolume) => - post( - updateLockSettingUrl.toUrl, - jsonEncode({ - 'lockId': lockId, - 'lockSound': lockSound, - 'lockSoundVolume': lockSoundVolume, - })); + Future setLockSoundData(int lockId, int lockSound, int lockSoundVolume) => post( + updateLockSettingUrl.toUrl, + jsonEncode({ + 'lockId': lockId, + 'lockSound': lockSound, + 'lockSoundVolume': lockSoundVolume, + })); // 防撬报警 Future setBurglarAlarmData(int lockId, int antiPrySwitch) => post( @@ -806,14 +727,12 @@ class ApiProvider extends BaseProvider { })); // 开门方向 - Future setOpenDoorDirectionData( - int lockId, int openDirectionValue) => - post( - updateLockSettingUrl.toUrl, - jsonEncode({ - 'lockId': lockId, - 'openDirectionValue': openDirectionValue, - })); + Future setOpenDoorDirectionData(int lockId, int openDirectionValue) => post( + updateLockSettingUrl.toUrl, + jsonEncode({ + 'lockId': lockId, + 'openDirectionValue': openDirectionValue, + })); // 电机扭力设置 Future setMotorPowerData(int lockId, int motorTorsion) => post( @@ -824,14 +743,12 @@ class ApiProvider extends BaseProvider { })); // 远程开锁 - Future remoteUnlockingOpenOrCloseLoadData( - int lockId, int remoteUnlock) => - post( - updateLockSettingUrl.toUrl, - jsonEncode({ - 'lockId': lockId, - 'remoteUnlock': remoteUnlock, - })); + Future remoteUnlockingOpenOrCloseLoadData(int lockId, int remoteUnlock) => post( + updateLockSettingUrl.toUrl, + jsonEncode({ + 'lockId': lockId, + 'remoteUnlock': remoteUnlock, + })); // 重置键 Future setResetButtonData(int lockId, int resetSwitch) => post( @@ -850,13 +767,12 @@ class ApiProvider extends BaseProvider { })); // 设置开锁时是否需联网 - Future setOpenLockNeedOnlineData(int lockId, int appUnlockOnline) => - post( - updateLockSettingUrl.toUrl, - jsonEncode({ - 'lockId': lockId, - 'appUnlockOnline': appUnlockOnline, - })); + Future setOpenLockNeedOnlineData(int lockId, int appUnlockOnline) => post( + updateLockSettingUrl.toUrl, + jsonEncode({ + 'lockId': lockId, + 'appUnlockOnline': appUnlockOnline, + })); // 设置标记房态 Future setRoomStatusData(int lockId, int roomStatus) => post( @@ -867,15 +783,13 @@ class ApiProvider extends BaseProvider { })); // 设置常开模式 - Future setNormallyModeData( - int lockId, int passageMode, List passageModeConfig) => - post( - updateLockSettingUrl.toUrl, - jsonEncode({ - 'lockId': lockId, - 'passageMode': passageMode, - 'passageModeConfig': passageModeConfig, - })); + Future setNormallyModeData(int lockId, int passageMode, List passageModeConfig) => post( + updateLockSettingUrl.toUrl, + jsonEncode({ + 'lockId': lockId, + 'passageMode': passageMode, + 'passageModeConfig': passageModeConfig, + })); // 通过网关获取锁的时间 Future getLockTimeFromGatewayLoadData(String lockId) => post( @@ -894,19 +808,11 @@ class ApiProvider extends BaseProvider { // 获取服务器当前时间 Future getServerDatetimeLoadData(bool isUnShowLoading) => - post(getServerDatetimeUrl.toUrl, jsonEncode({}), - isUnShowLoading: isUnShowLoading); + post(getServerDatetimeUrl.toUrl, jsonEncode({}), isUnShowLoading: isUnShowLoading); // 锁诊断 - Future setLockDiagnoseData( - String lockId, - String electricQuantity, - String firmwareRevision, - String hardwareRevision, - String lockDate, - String modelNum, - String pwdInfo, - String timestamp) => + Future setLockDiagnoseData(String lockId, String electricQuantity, String firmwareRevision, + String hardwareRevision, String lockDate, String modelNum, String pwdInfo, String timestamp) => post( lockDiagnoseUrl.toUrl, jsonEncode({ @@ -947,13 +853,8 @@ class ApiProvider extends BaseProvider { isUnShowLoading: true); // 设置考勤时创建公司 - Future setCheckInCreateCompanyData( - String lockId, - String attendanceType, - String companyName, - List workDay, - String workEndTime, - String workStartTime) => + Future setCheckInCreateCompanyData(String lockId, String attendanceType, String companyName, List workDay, + String workEndTime, String workStartTime) => post( setCheckInCreateCompanyURL.toUrl, jsonEncode({ @@ -974,13 +875,12 @@ class ApiProvider extends BaseProvider { isUnShowLoading: true); // 获取开锁提醒 - Future setLockPickingReminderData(int lockId, int unlockReminder) => - post( - updateLockSettingUrl.toUrl, - jsonEncode({ - 'lockId': lockId, - 'unlockReminder': unlockReminder, - })); + Future setLockPickingReminderData(int lockId, int unlockReminder) => post( + updateLockSettingUrl.toUrl, + jsonEncode({ + 'lockId': lockId, + 'unlockReminder': unlockReminder, + })); // 获取员工列表 Future getStaffListData(String companyId, String lockId) => post( @@ -991,24 +891,17 @@ class ApiProvider extends BaseProvider { })); // 删除 - Future deletStaffData(int lockId, int staffId, int deleteKey) => - post( - deleteStaffURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'staffId': staffId, - 'deleteKey': deleteKey, - })); + Future deletStaffData(int lockId, int staffId, int deleteKey) => post( + deleteStaffURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'staffId': staffId, + 'deleteKey': deleteKey, + })); // 添加员工 - Future addStaffData( - String attendanceType, - String attendanceWay, - String companyId, - String have, - String staffName, - String countryCode, - String usernameType) => + Future addStaffData(String attendanceType, String attendanceWay, String companyId, String have, + String staffName, String countryCode, String usernameType) => post( addStaffURL.toUrl, jsonEncode({ @@ -1022,14 +915,8 @@ class ApiProvider extends BaseProvider { })); // 编辑员工 addHolidaysData - Future editStaffData( - String attendanceType, - String attendanceWay, - String staffId, - String have, - String staffName, - String countryCode, - String usernameType) => + Future editStaffData(String attendanceType, String attendanceWay, String staffId, String have, + String staffName, String countryCode, String usernameType) => post( editStaffURL.toUrl, jsonEncode({ @@ -1051,11 +938,7 @@ class ApiProvider extends BaseProvider { })); // 添加假期 - Future addHolidaysData( - String companyId, - String fillClassDate, - String vacationEndDate, - String vacationName, + Future addHolidaysData(String companyId, String fillClassDate, String vacationEndDate, String vacationName, String vacationStartDate) => post( addHolidaysURL.toUrl, @@ -1068,13 +951,12 @@ class ApiProvider extends BaseProvider { })); // 假期列表 - Future holidaysListData(String companyId, String vacationYear) => - post( - holidaysListURL.toUrl, - jsonEncode({ - 'companyId': companyId, - 'vacationYear': vacationYear, - })); + Future holidaysListData(String companyId, String vacationYear) => post( + holidaysListURL.toUrl, + jsonEncode({ + 'companyId': companyId, + 'vacationYear': vacationYear, + })); // 删除假期 Future deletHolidaysData(String vacationId) => post( @@ -1091,14 +973,8 @@ class ApiProvider extends BaseProvider { })); // 修改考勤设置信息 - Future editCheckInSetInfoData( - String attendanceType, - String companyId, - String type, - String companyName, - String workEndTime, - String workStartTime, - List workDay) => + Future editCheckInSetInfoData(String attendanceType, String companyId, String type, String companyName, + String workEndTime, String workStartTime, List workDay) => post( editCheckInSetInfoURL.toUrl, jsonEncode({ @@ -1112,66 +988,54 @@ class ApiProvider extends BaseProvider { })); // 获取考勤列表 -- 早到榜日榜 - Future getCheckInListEarlyArrivalWithDateData( - String companyId, String attendanceDate) => - post( - getAttendanceRecordListByDateURL.toUrl, - jsonEncode({ - 'companyId': companyId, - 'attendanceDate': attendanceDate, - })); + Future getCheckInListEarlyArrivalWithDateData(String companyId, String attendanceDate) => post( + getAttendanceRecordListByDateURL.toUrl, + jsonEncode({ + 'companyId': companyId, + 'attendanceDate': attendanceDate, + })); // 获取考勤列表 -- 早到榜月榜 - Future getCheckInListEarlyArrivalWithMonthData( - String companyId, String attendanceDate) => - post( - getAttendanceRecordListByMonthURL.toUrl, - jsonEncode({ - 'companyId': companyId, - 'attendanceDate': attendanceDate, - })); + Future getCheckInListEarlyArrivalWithMonthData(String companyId, String attendanceDate) => post( + getAttendanceRecordListByMonthURL.toUrl, + jsonEncode({ + 'companyId': companyId, + 'attendanceDate': attendanceDate, + })); // 获取考勤列表 -- 迟到榜日榜 - Future getCheckInListLateTimesWithDateData( - String companyId, String attendanceDate) => - post( - getAttendanceRecordListLateTimesByDateURL.toUrl, - jsonEncode({ - 'companyId': companyId, - 'attendanceDate': attendanceDate, - })); + Future getCheckInListLateTimesWithDateData(String companyId, String attendanceDate) => post( + getAttendanceRecordListLateTimesByDateURL.toUrl, + jsonEncode({ + 'companyId': companyId, + 'attendanceDate': attendanceDate, + })); // 获取考勤列表 -- 迟到榜月榜 - Future getCheckInListLateTimesWithMonthData( - String companyId, String attendanceDate) => - post( - getAttendanceRecordListLateTimesByMonthURL.toUrl, - jsonEncode({ - 'companyId': companyId, - 'attendanceDate': attendanceDate, - })); + Future getCheckInListLateTimesWithMonthData(String companyId, String attendanceDate) => post( + getAttendanceRecordListLateTimesByMonthURL.toUrl, + jsonEncode({ + 'companyId': companyId, + 'attendanceDate': attendanceDate, + })); // 获取考勤列表 -- 勤奋榜 - Future getCheckInListHardworkingData( - String companyId, String attendanceDate, String type) => - post( - getAttendanceRecordHardworkingListURL.toUrl, - jsonEncode({ - 'companyId': companyId, - 'attendanceDate': attendanceDate, - 'type': type, - })); + Future getCheckInListHardworkingData(String companyId, String attendanceDate, String type) => post( + getAttendanceRecordHardworkingListURL.toUrl, + jsonEncode({ + 'companyId': companyId, + 'attendanceDate': attendanceDate, + 'type': type, + })); // 获取考勤详情 - Future getCheckInDetailData( - String companyId, String attendanceDate, String staffId) => - post( - getAttendanceRecordDtailURL.toUrl, - jsonEncode({ - 'companyId': companyId, - 'attendanceDate': attendanceDate, - 'staffId': staffId, - })); + Future getCheckInDetailData(String companyId, String attendanceDate, String staffId) => post( + getAttendanceRecordDtailURL.toUrl, + jsonEncode({ + 'companyId': companyId, + 'attendanceDate': attendanceDate, + 'staffId': staffId, + })); // 获取指纹详情 Future getFingerprintsData(int fingerprintId) => post( @@ -1181,16 +1045,14 @@ class ApiProvider extends BaseProvider { })); // 获取指纹列表 - Future getFingerprintsListData( - String lockId, String pageNo, String pageSize, String searchStr) => - post( - getFingerprintListURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'pageNo': pageNo, - 'pageSize': pageSize, - 'searchStr': searchStr, - })); + Future getFingerprintsListData(String lockId, String pageNo, String pageSize, String searchStr) => post( + getFingerprintListURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'pageNo': pageNo, + 'pageSize': pageSize, + 'searchStr': searchStr, + })); // 添加指纹 Future addFingerprintsData( @@ -1256,45 +1118,28 @@ class ApiProvider extends BaseProvider { })); // 删除指纹 - Future deletFingerprintsData(String fingerprintId, String lockId, - String type, String deleteType) => - post( - deleteFingerprintURL.toUrl, - jsonEncode({ - 'fingerprintId': fingerprintId, - 'lockId': lockId, - 'type': type, - 'deleteType': deleteType - })); + Future deletFingerprintsData(String fingerprintId, String lockId, String type, String deleteType) => post( + deleteFingerprintURL.toUrl, + jsonEncode({'fingerprintId': fingerprintId, 'lockId': lockId, 'type': type, 'deleteType': deleteType})); // 更新指纹用户序号 - Future updateFingerprintUserNoLoadData( - String fingerprintId, String lockId, String fingerprintUserNo) => - post( - updateFingerprintUserNoURL.toUrl, - jsonEncode({ - 'fingerprintId': fingerprintId, - 'lockId': lockId, - 'fingerprintUserNo': fingerprintUserNo - })); + Future updateFingerprintUserNoLoadData(String fingerprintId, String lockId, String fingerprintUserNo) => + post(updateFingerprintUserNoURL.toUrl, + jsonEncode({'fingerprintId': fingerprintId, 'lockId': lockId, 'fingerprintUserNo': fingerprintUserNo})); // 校验指纹名字是否重复 - Future checkFingerprintNameDuplicatedData( - String lockId, String fingerprintName) => - post(checkFingerprintNameURL.toUrl, - jsonEncode({'lockId': lockId, 'fingerprintName': fingerprintName})); + Future checkFingerprintNameDuplicatedData(String lockId, String fingerprintName) => + post(checkFingerprintNameURL.toUrl, jsonEncode({'lockId': lockId, 'fingerprintName': fingerprintName})); // 获取人脸列表 - Future getFaceListData( - String lockId, String pageNo, String pageSize, String searchStr) => - post( - getFaceListURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'pageNo': pageNo, - 'pageSize': pageSize, - 'searchStr': searchStr, - })); + Future getFaceListData(String lockId, String pageNo, String pageSize, String searchStr) => post( + getFaceListURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'pageNo': pageNo, + 'pageSize': pageSize, + 'searchStr': searchStr, + })); // 添加人脸 Future addFaceData( @@ -1329,40 +1174,20 @@ class ApiProvider extends BaseProvider { })); // 校验人脸名字是否重复 - Future checkFaceNameDuplicatedData( - String lockId, String faceName) => - post(checkFaceNameURL.toUrl, - jsonEncode({'lockId': lockId, 'faceName': faceName})); + Future checkFaceNameDuplicatedData(String lockId, String faceName) => + post(checkFaceNameURL.toUrl, jsonEncode({'lockId': lockId, 'faceName': faceName})); // 更新人脸用户序号 - Future updateFaceUserNo( - int faceId, int lockId, String faceUserNo) => - post( - updateFaceUserNoURL.toUrl, - jsonEncode( - {'faceId': faceId, 'lockId': lockId, 'faceUserNo': faceUserNo})); + Future updateFaceUserNo(int faceId, int lockId, String faceUserNo) => + post(updateFaceUserNoURL.toUrl, jsonEncode({'faceId': faceId, 'lockId': lockId, 'faceUserNo': faceUserNo})); // 更新人脸用户信息--人脸名称、有效期 Future updateFaceName(int faceId, int lockId, String faceName) => - post( - updateFaceUserInfoURL.toUrl, - jsonEncode( - {'faceId': faceId, 'lockId': lockId, 'faceName': faceName})); + post(updateFaceUserInfoURL.toUrl, jsonEncode({'faceId': faceId, 'lockId': lockId, 'faceName': faceName})); // 更新人脸用户信息--有效期 - Future updateFaceValidity( - int faceId, - int lockId, - int startDate, - int endDate, - int startTime, - int endTime, - int faceType, - List weekDay, - String faceName, - String addType, - int isCoerced, - int faceRight) => + Future updateFaceValidity(int faceId, int lockId, int startDate, int endDate, int startTime, int endTime, + int faceType, List weekDay, String faceName, String addType, int isCoerced, int faceRight) => post( updateFaceUserInfoURL.toUrl, jsonEncode({ @@ -1399,16 +1224,14 @@ class ApiProvider extends BaseProvider { Future getMallURLData() => post(getMallURL.toUrl, jsonEncode({})); // 获取IC卡列表 - Future getICCardListData( - String lockId, String pageNo, String pageSize, String searchStr) => - post( - getICCardListURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'pageNo': pageNo, - 'pageSize': pageSize, - 'searchStr': searchStr, - })); + Future getICCardListData(String lockId, String pageNo, String pageSize, String searchStr) => post( + getICCardListURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'pageNo': pageNo, + 'pageSize': pageSize, + 'searchStr': searchStr, + })); // 添加卡 Future addICCardData( @@ -1475,42 +1298,26 @@ class ApiProvider extends BaseProvider { })); // 删除卡 - Future deletIcCardData( - String cardId, String lockId, String type, String deleteType) => - post( - deleteICCardURL.toUrl, - jsonEncode({ - 'cardId': cardId, - 'lockId': lockId, - 'type': type, - 'deleteType': deleteType - })); + Future deletIcCardData(String cardId, String lockId, String type, String deleteType) => post( + deleteICCardURL.toUrl, jsonEncode({'cardId': cardId, 'lockId': lockId, 'type': type, 'deleteType': deleteType})); // 更新ICCard序号 - Future updateIdCardUserNoLoadData( - String lockId, String cardId, String cardUserNo) => - post( - updateICCardUserNoURL.toUrl, - jsonEncode( - {'cardId': cardId, 'lockId': lockId, 'cardUserNo': cardUserNo})); + Future updateIdCardUserNoLoadData(String lockId, String cardId, String cardUserNo) => + post(updateICCardUserNoURL.toUrl, jsonEncode({'cardId': cardId, 'lockId': lockId, 'cardUserNo': cardUserNo})); // 校验卡名字是否重复 - Future checkCardNameDuplicatedData( - String lockId, String cardName) => - post(checkCardNameURL.toUrl, - jsonEncode({'lockId': lockId, 'cardName': cardName})); + Future checkCardNameDuplicatedData(String lockId, String cardName) => + post(checkCardNameURL.toUrl, jsonEncode({'lockId': lockId, 'cardName': cardName})); // 获取遥控列表 - Future getRemoteControlListData( - String lockId, String pageNo, String pageSize, String searchStr) => - post( - getRemoteControlListURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'pageNo': pageNo, - 'pageSize': pageSize, - 'searchStr': searchStr, - })); + Future getRemoteControlListData(String lockId, String pageNo, String pageSize, String searchStr) => post( + getRemoteControlListURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'pageNo': pageNo, + 'pageSize': pageSize, + 'searchStr': searchStr, + })); // 添加遥控 Future addRemoteControlData( @@ -1549,15 +1356,8 @@ class ApiProvider extends BaseProvider { })); // 更新遥控序号 - Future updateRemoteUserNoLoadData( - int lockId, int remoteId, String remoteUserNo) => - post( - updateRemoteUserNoURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'remoteId': remoteId, - 'remoteUserNo': remoteUserNo - })); + Future updateRemoteUserNoLoadData(int lockId, int remoteId, String remoteUserNo) => post( + updateRemoteUserNoURL.toUrl, jsonEncode({'lockId': lockId, 'remoteId': remoteId, 'remoteUserNo': remoteUserNo})); // 编辑遥控 Future editRemoteControlData( @@ -1606,36 +1406,22 @@ class ApiProvider extends BaseProvider { })); // 校验遥控名字是否重复 - Future checkRemoteControlNameDuplicatedData( - String lockId, String remoteName) => - post(checkRemoteControlNameURL.toUrl, - jsonEncode({'lockId': lockId, 'remoteName': remoteName})); + Future checkRemoteControlNameDuplicatedData(String lockId, String remoteName) => + post(checkRemoteControlNameURL.toUrl, jsonEncode({'lockId': lockId, 'remoteName': remoteName})); // 获取掌静脉列表 - Future getPalmListData( - String lockId, String pageNo, String pageSize, String searchStr) => - post( - getPalmListURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'pageNo': pageNo, - 'pageSize': pageSize, - 'searchStr': searchStr, - })); + Future getPalmListData(String lockId, String pageNo, String pageSize, String searchStr) => post( + getPalmListURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'pageNo': pageNo, + 'pageSize': pageSize, + 'searchStr': searchStr, + })); // 添加掌静脉 - Future addPalmData( - String lockId, - String palmVeinName, - String palmVeinNumber, - int palmVeinType, - int startDate, - int endDate, - int addType, - List weekDay, - int startTime, - int endTime, - int palmVeinRight) => + Future addPalmData(String lockId, String palmVeinName, String palmVeinNumber, int palmVeinType, + int startDate, int endDate, int addType, List weekDay, int startTime, int endTime, int palmVeinRight) => post( addPalmURL.toUrl, jsonEncode({ @@ -1653,15 +1439,9 @@ class ApiProvider extends BaseProvider { })); // 更新掌静脉序号 - Future updatePalmUserNoLoadData( - int lockId, int palmVeinId, String palmVeinUserNo) => - post( - updatePalmUserNoURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'palmVeinId': palmVeinId, - 'palmVeinUserNo': palmVeinUserNo - })); + Future updatePalmUserNoLoadData(int lockId, int palmVeinId, String palmVeinUserNo) => post( + updatePalmUserNoURL.toUrl, + jsonEncode({'lockId': lockId, 'palmVeinId': palmVeinId, 'palmVeinUserNo': palmVeinUserNo})); // 编辑掌静脉 Future editPalmData( @@ -1710,60 +1490,34 @@ class ApiProvider extends BaseProvider { })); // 校验掌静脉名字是否重复 - Future checkPalmNameDuplicatedData( - String lockId, String palmVeinName) => - post(checkPalmNameURL.toUrl, - jsonEncode({'lockId': lockId, 'palmVeinName': palmVeinName})); + Future checkPalmNameDuplicatedData(String lockId, String palmVeinName) => + post(checkPalmNameURL.toUrl, jsonEncode({'lockId': lockId, 'palmVeinName': palmVeinName})); // 获取转移锁锁列表 Future getTransferLockListData(String searchStr) => post(transferLockListURL.toUrl, jsonEncode({'searchStr': searchStr})); // 转移智能锁确认 - Future transferLockConfirmInfoData( - String receiverUsername, String type, String countryCode) => - post( - transferLockConfirmURL.toUrl, - jsonEncode({ - 'receiverUsername': receiverUsername, - 'type': type, - 'countryCode': countryCode - })); + Future transferLockConfirmInfoData(String receiverUsername, String type, String countryCode) => post( + transferLockConfirmURL.toUrl, + jsonEncode({'receiverUsername': receiverUsername, 'type': type, 'countryCode': countryCode})); // 转移智能锁 - Future transferLockInfoData( - String receiverUsername, List lockIdList, String countryCode) => - post( - transferLockURL.toUrl, - jsonEncode({ - 'receiverUsername': receiverUsername, - 'lockIdList': lockIdList, - 'countryCode': countryCode - })); + Future transferLockInfoData(String receiverUsername, List lockIdList, String countryCode) => post( + transferLockURL.toUrl, + jsonEncode({'receiverUsername': receiverUsername, 'lockIdList': lockIdList, 'countryCode': countryCode})); // 获取网关列表 - Future getGatewayListData( - String pageNo, String pageSize, int timeout) => - post(gatewaykListURL.toUrl, - jsonEncode({'pageNo': pageNo, 'pageSize': pageSize}), - timeout: timeout); + Future getGatewayListData(String pageNo, String pageSize, int timeout) => + post(gatewaykListURL.toUrl, jsonEncode({'pageNo': pageNo, 'pageSize': pageSize}), timeout: timeout); // 获取网关详情 Future getGatewayDetailData(int gatewayId, int timeout) => - post(gatewayDetailURL.toUrl, jsonEncode({'gatewayId': gatewayId}), - timeout: timeout); + post(gatewayDetailURL.toUrl, jsonEncode({'gatewayId': gatewayId}), timeout: timeout); // 添加网关 - Future addGatewayNetwork( - String gatewayName, - String gatewayMac, - String serialNumber, - int gatewayType, - String networkName, - String networkMac, - String version, - Map gatewayJson, - int timeout) => + Future addGatewayNetwork(String gatewayName, String gatewayMac, String serialNumber, int gatewayType, + String networkName, String networkMac, String version, Map gatewayJson, int timeout) => post( addGatewayURL.toUrl, jsonEncode({ @@ -1779,25 +1533,22 @@ class ApiProvider extends BaseProvider { timeout: timeout); // 删除网关 - Future deletGateway(int gatewayId, int isForce, int timeout) => - post( - deletGatewayURL.toUrl, - jsonEncode({ - 'gatewayId': gatewayId, - 'isForce': isForce, - }), - timeout: timeout); + Future deletGateway(int gatewayId, int isForce, int timeout) => post( + deletGatewayURL.toUrl, + jsonEncode({ + 'gatewayId': gatewayId, + 'isForce': isForce, + }), + timeout: timeout); // 网关更新 - Future gatewayUpdate( - int gatewayId, String gatewayName, int timeout) => - post( - updateGatewayURL.toUrl, - jsonEncode({ - 'gatewayId': gatewayId, - 'gatewayName': gatewayName, - }), - timeout: timeout); + Future gatewayUpdate(int gatewayId, String gatewayName, int timeout) => post( + updateGatewayURL.toUrl, + jsonEncode({ + 'gatewayId': gatewayId, + 'gatewayName': gatewayName, + }), + timeout: timeout); // 远程开锁 Future remoteOpenLock(String lockId, int timeOut) => post( @@ -1808,64 +1559,39 @@ class ApiProvider extends BaseProvider { timeout: timeOut); // 转移网关确认 - Future transferGatewayConfirmInfoData( - String receiverUsername, String type, String countryCode) => - post( - transferGatewayConfirmURL.toUrl, - jsonEncode({ - 'receiverUsername': receiverUsername, - 'type': type, - 'countryCode': countryCode - })); + Future transferGatewayConfirmInfoData(String receiverUsername, String type, String countryCode) => post( + transferGatewayConfirmURL.toUrl, + jsonEncode({'receiverUsername': receiverUsername, 'type': type, 'countryCode': countryCode})); // 转移网关 - Future transferGatewayInfoData( - String receiverUsername, List plugIdList, String countryCode) => - post( - transferGatewayURL.toUrl, - jsonEncode({ - 'receiverUsername': receiverUsername, - 'plugIdList': plugIdList, - 'countryCode': countryCode - })); + Future transferGatewayInfoData(String receiverUsername, List plugIdList, String countryCode) => post( + transferGatewayURL.toUrl, + jsonEncode({'receiverUsername': receiverUsername, 'plugIdList': plugIdList, 'countryCode': countryCode})); // 获取网关配置 Future getGatewayConfiguration(int timeout) => post(getGatewayConfigURL.toUrl, jsonEncode({}), timeout: timeout); Future getGatewayConfigurationNotLoading(int timeout) => - post(getGatewayConfigURL.toUrl, jsonEncode({}), - timeout: timeout, isUnShowLoading: true); + post(getGatewayConfigURL.toUrl, jsonEncode({}), timeout: timeout, isUnShowLoading: true); - Future gatewayConnectionLockListLoadData( - int gatewayId, int timeout) => - post(gatewayListByLockURL.toUrl, jsonEncode({'gatewayId': gatewayId}), - timeout: timeout); + Future gatewayConnectionLockListLoadData(int gatewayId, int timeout) => + post(gatewayListByLockURL.toUrl, jsonEncode({'gatewayId': gatewayId}), timeout: timeout); Future gatewayScanDevice(int gatewayId, int timeout) => - post(gatewayScanDeviceURL.toUrl, jsonEncode({'gatewayId': gatewayId}), - timeout: timeout); + post(gatewayScanDeviceURL.toUrl, jsonEncode({'gatewayId': gatewayId}), timeout: timeout); // 移除坏锁 Future removeBrokenLockData(List lockIdList) => post(removeBadLockURL.toUrl, jsonEncode({'lockIds': lockIdList})); - Future listLockByGroup(String type, String keyGroupId) => post( - listLockByGroupURL.toUrl, - jsonEncode({'type': type, 'keyGroupId': keyGroupId})); + Future listLockByGroup(String type, String keyGroupId) => + post(listLockByGroupURL.toUrl, jsonEncode({'type': type, 'keyGroupId': keyGroupId})); - Future getKeyDetail(String lockId) => - post(getKeyDetailURL.toUrl, jsonEncode({'lockId': lockId})); + Future getKeyDetail(String lockId) => post(getKeyDetailURL.toUrl, jsonEncode({'lockId': lockId})); - Future lockUserList( - String pageNo, String pageSize, String searchStr) => - post( - lockUserListURL.toUrl, - jsonEncode({ - 'pageNo': pageNo, - 'pageSize': pageSize, - 'searchStr': searchStr - })); + Future lockUserList(String pageNo, String pageSize, String searchStr) => + post(lockUserListURL.toUrl, jsonEncode({'pageNo': pageNo, 'pageSize': pageSize, 'searchStr': searchStr})); Future deletLockUser(int uid) => post( deletLockUserURL.toUrl, @@ -1874,27 +1600,22 @@ class ApiProvider extends BaseProvider { })); Future keyListByUser(String pageNo, String pageSize, String uid) => - post(keyListByUserURL.toUrl, - jsonEncode({'pageNo': pageNo, 'pageSize': pageSize, 'uid': uid})); + post(keyListByUserURL.toUrl, jsonEncode({'pageNo': pageNo, 'pageSize': pageSize, 'uid': uid})); - Future authorizedAdminList(String pageNo, String pageSize) => post( - authorizedAdminListURL.toUrl, - jsonEncode({'pageNo': pageNo, 'pageSize': pageSize})); + Future authorizedAdminList(String pageNo, String pageSize) => + post(authorizedAdminListURL.toUrl, jsonEncode({'pageNo': pageNo, 'pageSize': pageSize})); - Future authorizedAdminDetail(int uid) => - post(authorizedAdminDetailURL.toUrl, jsonEncode({'uid': uid})); + Future authorizedAdminDetail(int uid) => post(authorizedAdminDetailURL.toUrl, jsonEncode({'uid': uid})); //获取授权管理员下锁列表 Future administratorOwnLockList(int uid) => post(administratorOwnLockListURL.toUrl, jsonEncode({'uid': uid})); - Future deleteAuthorizedAdmin( - String uid, String includeUnderlings) => - post(deleteAdministratorURL.toUrl, - jsonEncode({'uid': uid, 'includeUnderlings': includeUnderlings})); + Future deleteAuthorizedAdmin(String uid, String includeUnderlings) => + post(deleteAdministratorURL.toUrl, jsonEncode({'uid': uid, 'includeUnderlings': includeUnderlings})); - Future updateAuthorizedAdmin(String uid, String name, - String endDate, String startDate, String isRemoteUnlock) => + Future updateAuthorizedAdmin( + String uid, String name, String endDate, String startDate, String isRemoteUnlock) => post( updateAdministratorURL.toUrl, jsonEncode({ @@ -1905,22 +1626,18 @@ class ApiProvider extends BaseProvider { 'isRemoteUnlock': isRemoteUnlock })); - Future setAlertMode(String alertMode, String isOn) => post( - setAlertModeURL.toUrl, - jsonEncode({'alertMode': alertMode, 'isOn': isOn})); + Future setAlertMode(String alertMode, String isOn) => + post(setAlertModeURL.toUrl, jsonEncode({'alertMode': alertMode, 'isOn': isOn})); Future changeSettings(String isOn, String type) => post(changeSettingsURL.toUrl, jsonEncode({'isOn': isOn, 'type': type})); - Future setTouchUnlockFlag(String isOn) => - post(setTouchUnlockFlagURL.toUrl, jsonEncode({'isOn': isOn})); + Future setTouchUnlockFlag(String isOn) => post(setTouchUnlockFlagURL.toUrl, jsonEncode({'isOn': isOn})); - Future userSettingsInfo() => - post(userSettingsInfoURL.toUrl, jsonEncode({})); + Future userSettingsInfo() => post(userSettingsInfoURL.toUrl, jsonEncode({})); - Future canSendKey(String endDate, List lockIdList) => post( - canSendKeyURL.toUrl, - jsonEncode({'endDate': endDate, 'lockIdList': lockIdList})); + Future canSendKey(String endDate, List lockIdList) => + post(canSendKeyURL.toUrl, jsonEncode({'endDate': endDate, 'lockIdList': lockIdList})); Future batchSendKey( List lockIds, @@ -1989,17 +1706,12 @@ class ApiProvider extends BaseProvider { post(userLogout3URL.toUrl, jsonEncode({'storageNonce': storageNonce})); //删除账号 - Future deleteAccount( - String channel, String verificationCode) => - post( - deleteAccountURL.toUrl, - jsonEncode( - {'channel': channel, 'verificationCode': verificationCode})); + Future deleteAccount(String channel, String verificationCode) => + post(deleteAccountURL.toUrl, jsonEncode({'channel': channel, 'verificationCode': verificationCode})); // 获取个人信息 Future getUserInfo(String operatorUid) => - post(getUserInfoURL.toUrl, jsonEncode({'operatorUid': operatorUid}), - isUnShowLoading: true); + post(getUserInfoURL.toUrl, jsonEncode({'operatorUid': operatorUid}), isUnShowLoading: true); // 重置密码钥匙 Future keyboardPwdReset(String lockId, List passwordKey) => post( @@ -2010,8 +1722,8 @@ class ApiProvider extends BaseProvider { })); //登陆后可使用获取验证码,免图片滑动验证 - Future sendValidationCodeAuth(String countryCode, String account, - String channel, String codeType, String xWidth) => + Future sendValidationCodeAuth( + String countryCode, String account, String channel, String codeType, String xWidth) => post( sendValidationCodeAuthURL.toUrl, jsonEncode({ @@ -2058,61 +1770,46 @@ class ApiProvider extends BaseProvider { })); //修改绑定手机号 - Future bindPhone(String countryCode, String account, - String verificationCode, String unbindToken) => - post( - bindPhoneURL.toUrl, - jsonEncode({ - 'countryCode': countryCode, - 'account': account, - 'verificationCode': verificationCode, - 'unbindToken': unbindToken - })); + Future bindPhone(String countryCode, String account, String verificationCode, String unbindToken) => post( + bindPhoneURL.toUrl, + jsonEncode({ + 'countryCode': countryCode, + 'account': account, + 'verificationCode': verificationCode, + 'unbindToken': unbindToken + })); //修改绑定邮箱 - Future bindEmail( - String email, String verificationCode, String unbindToken) => - post( - bindEmailURL.toUrl, - jsonEncode({ - 'email': email, - 'verificationCode': verificationCode, - 'unbindToken': unbindToken - })); + Future bindEmail(String email, String verificationCode, String unbindToken) => post(bindEmailURL.toUrl, + jsonEncode({'email': email, 'verificationCode': verificationCode, 'unbindToken': unbindToken})); //修改密码 - Future changePassword( - String date, String newPassword, String oldPassword) => - post( - changePasswordURL.toUrl, - jsonEncode({ - 'date': date, - 'newPassword': newPassword, - 'oldPassword': oldPassword, - })); + Future changePassword(String date, String newPassword, String oldPassword) => post( + changePasswordURL.toUrl, + jsonEncode({ + 'date': date, + 'newPassword': newPassword, + 'oldPassword': oldPassword, + })); //获取安全信息列表 - Future getQuestionList(String operatorUid, String countryCode) => - post( - getQuestionListURL.toUrl, - jsonEncode({ - 'operatorUid': operatorUid, - 'countryCode': countryCode, - })); + Future getQuestionList(String operatorUid, String countryCode) => post( + getQuestionListURL.toUrl, + jsonEncode({ + 'operatorUid': operatorUid, + 'countryCode': countryCode, + })); //获取已设置的安全信息 - Future getOwnQuestionList() => - post(getOwnQuestionListURL.toUrl, jsonEncode({})); + Future getOwnQuestionList() => post(getOwnQuestionListURL.toUrl, jsonEncode({})); //设置安全信息 - Future setSafeAnswer(List questionAndAnswerList) => post( - setSafeAnswerURL.toUrl, - jsonEncode({'questionAndAnswerList': questionAndAnswerList})); + Future setSafeAnswer(List questionAndAnswerList) => + post(setSafeAnswerURL.toUrl, jsonEncode({'questionAndAnswerList': questionAndAnswerList})); //修改安全信息 - Future updateSafeAnswer(List questionAndAnswerList) => post( - updateSafeAnswerURL.toUrl, - jsonEncode({'questionAndAnswerList': questionAndAnswerList})); + Future updateSafeAnswer(List questionAndAnswerList) => + post(updateSafeAnswerURL.toUrl, jsonEncode({'questionAndAnswerList': questionAndAnswerList})); // 获取上传文件的upToken 再调用updateUserInfo Future getUpHeadToken( @@ -2130,31 +1827,24 @@ class ApiProvider extends BaseProvider { })); // 文件上传 - Future uploadFile(String url, dynamic boay) => post(url, boay, - isUnUploadFile: false, - contentType: 'multipart/form-data', - isUserBaseUrl: false); + Future uploadFile(String url, dynamic boay) => + post(url, boay, isUnUploadFile: false, contentType: 'multipart/form-data', isUserBaseUrl: false); //获取解绑手机号Token - Future unbindPhoneToken(String verificationCode) => post( - unbindPhoneTokenURL.toUrl, - jsonEncode({'verificationCode': verificationCode})); + Future unbindPhoneToken(String verificationCode) => + post(unbindPhoneTokenURL.toUrl, jsonEncode({'verificationCode': verificationCode})); //获取解绑邮箱Token - Future unbindEmailToken(String verificationCode) => post( - unbindEmailTokenURL.toUrl, - jsonEncode({'verificationCode': verificationCode})); + Future unbindEmailToken(String verificationCode) => + post(unbindEmailTokenURL.toUrl, jsonEncode({'verificationCode': verificationCode})); //推送绑定DeviceID - Future pushBindAppId(String deviceId, int deviceType) => post( - pushBindAppIdURL.toUrl, - jsonEncode({'deviceId': deviceId, 'deviceType': deviceType})); + Future pushBindAppId(String deviceId, int deviceType) => + post(pushBindAppIdURL.toUrl, jsonEncode({'deviceId': deviceId, 'deviceType': deviceType})); //推送channel绑定 - Future pushBindChannels( - String storageNonce, List> channels) => - post(bindPushTokenURL.toUrl, - jsonEncode({'storageNonce': storageNonce, 'channels': channels})); + Future pushBindChannels(String storageNonce, List> channels) => + post(bindPushTokenURL.toUrl, jsonEncode({'storageNonce': storageNonce, 'channels': channels})); // 消息列表 Future messageListLoadData(String pageNo, String pageSize) => post( @@ -2180,46 +1870,39 @@ class ApiProvider extends BaseProvider { })); // 删除所有消息 - Future deletAllMessageLoadData() => - post(deletAllMessageURL.toUrl, jsonEncode({})); + Future deletAllMessageLoadData() => post(deletAllMessageURL.toUrl, jsonEncode({})); // 获取最新版本号 - Future getVersionData(String brandName, String currentVersion) => - post( - getVersionURL.toUrl, - jsonEncode({ - 'brandName': brandName, - 'currentVersion': currentVersion, - })); + Future getVersionData(String brandName, String currentVersion) => post( + getVersionURL.toUrl, + jsonEncode({ + 'brandName': brandName, + 'currentVersion': currentVersion, + })); // 设置猫眼工作模式 - Future updateCatEyeModeConfig(int lockId, List catEyeConfig) => - post( - updateCatEyeConfigURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'catEyeConfig': catEyeConfig, - })); + Future updateCatEyeModeConfig(int lockId, List catEyeConfig) => post( + updateCatEyeConfigURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'catEyeConfig': catEyeConfig, + })); // 设置自动亮屏 - Future updateAutoLightScreenConfig( - int lockId, int autoLightScreen) => - post( - updateCatEyeConfigURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'autoLightScreen': autoLightScreen, - })); + Future updateAutoLightScreenConfig(int lockId, int autoLightScreen) => post( + updateCatEyeConfigURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'autoLightScreen': autoLightScreen, + })); // 设置亮屏持续时间 - Future updateLightScreenTimeConfig( - int lockId, int autoLightScreenTime) => - post( - updateCatEyeConfigURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'autoLightScreenTime': autoLightScreenTime, - })); + Future updateLightScreenTimeConfig(int lockId, int autoLightScreenTime) => post( + updateCatEyeConfigURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'autoLightScreenTime': autoLightScreenTime, + })); // 设置逗留警告 Future updateStayWarnConfig(int lockId, int stayWarn) => post( @@ -2230,13 +1913,12 @@ class ApiProvider extends BaseProvider { })); // 设置异常警告 - Future updateAbnormalWarnConfig(int lockId, int abnormalWarn) => - post( - updateCatEyeConfigURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'abnormalWarn': abnormalWarn, - })); + Future updateAbnormalWarnConfig(int lockId, int abnormalWarn) => post( + updateCatEyeConfigURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'abnormalWarn': abnormalWarn, + })); // 设置面容开锁 Future updateFaceSwitch(int lockId, int faceSwitch) => post( @@ -2247,33 +1929,28 @@ class ApiProvider extends BaseProvider { })); // 设置面容感应距离 - Future updateFaceSenseDistance( - int lockId, int faceInductionDistance) => - post( - updateLockSettingUrl.toUrl, - jsonEncode({ - 'lockId': lockId, - 'faceInductionDistance': faceInductionDistance, - })); + Future updateFaceSenseDistance(int lockId, int faceInductionDistance) => post( + updateLockSettingUrl.toUrl, + jsonEncode({ + 'lockId': lockId, + 'faceInductionDistance': faceInductionDistance, + })); // 设置面容防误开 - Future updateFacePreventMisrun(int lockId, int faceEnErrUnlock) => - post( - updateLockSettingUrl.toUrl, - jsonEncode({ - 'lockId': lockId, - 'faceEnErrUnlock': faceEnErrUnlock, - })); + Future updateFacePreventMisrun(int lockId, int faceEnErrUnlock) => post( + updateLockSettingUrl.toUrl, + jsonEncode({ + 'lockId': lockId, + 'faceEnErrUnlock': faceEnErrUnlock, + })); // 设置面容自动亮屏 - Future updateFaceAutoLightScreen( - int lockId, int faceAutoLightScreen) => - post( - updateFaceConfigURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'faceAutoLightScreen': faceAutoLightScreen, - })); + Future updateFaceAutoLightScreen(int lockId, int faceAutoLightScreen) => post( + updateFaceConfigURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'faceAutoLightScreen': faceAutoLightScreen, + })); // 获取锁消息设置 Future getLockNoticeSetting(int lockId) => post( @@ -2284,10 +1961,7 @@ class ApiProvider extends BaseProvider { // 设置N天未开门 Future updateNdaysNotCloseDoorNoticeSetting( - int lockId, - int dayNotOpenDoorState, - int dayNotOpenDoorValue, - List dayNotOpenDoorNoticeWayList) => + int lockId, int dayNotOpenDoorState, int dayNotOpenDoorValue, List dayNotOpenDoorNoticeWayList) => post( updateLockNoticeSettingURL.toUrl, jsonEncode({ @@ -2298,8 +1972,7 @@ class ApiProvider extends BaseProvider { })); // 设置低电量提醒 - Future updatelowElecNoticeStateSetting( - int lockId, int lowElecNoticeState, List lowElecNoticeWayList) => + Future updatelowElecNoticeStateSetting(int lockId, int lowElecNoticeState, List lowElecNoticeWayList) => post( updateLockNoticeSettingURL.toUrl, jsonEncode({ @@ -2357,55 +2030,31 @@ class ApiProvider extends BaseProvider { })); // 锁用户列表 - Future getLockKeysList(int lockId, String searchStr) => post( - lockKeysListURL.toUrl, - jsonEncode({'lockId': lockId, 'searchStr': searchStr})); + Future getLockKeysList(int lockId, String searchStr) => + post(lockKeysListURL.toUrl, jsonEncode({'lockId': lockId, 'searchStr': searchStr})); // 添加开门通知 - Future addLockNoticeSetting( - int lockId, int noticeType, Map settingValue) => - post( - addLockNoticeSettingURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'noticeType': noticeType, - 'settingValue': settingValue - })); + Future addLockNoticeSetting(int lockId, int noticeType, Map settingValue) => post( + addLockNoticeSettingURL.toUrl, + jsonEncode({'lockId': lockId, 'noticeType': noticeType, 'settingValue': settingValue})); // 开门通知列表 Future lockNoticeSettingAccountList(int lockId, int noticeType) => - post(lockNoticeSettingListURL.toUrl, - jsonEncode({'lockId': lockId, 'noticeType': noticeType})); + post(lockNoticeSettingListURL.toUrl, jsonEncode({'lockId': lockId, 'noticeType': noticeType})); // 删除开门通知 - Future deleteLockNoticeSettingAccount( - int lockNoticeSettingAccountId) => - post( - deleteLockNoticeSettingAccountURL.toUrl, - jsonEncode( - {'lockNoticeSettingAccountId': lockNoticeSettingAccountId})); + Future deleteLockNoticeSettingAccount(int lockNoticeSettingAccountId) => post( + deleteLockNoticeSettingAccountURL.toUrl, jsonEncode({'lockNoticeSettingAccountId': lockNoticeSettingAccountId})); // 更新开门通知 - Future updateLockNoticeSettingAccount( - int lockNoticeSettingAccountId, Map settingValue) => - post( - updateLockNoticeSettingAccountURL.toUrl, - jsonEncode({ - 'lockNoticeSettingAccountId': lockNoticeSettingAccountId, - 'settingValue': settingValue - })); + Future updateLockNoticeSettingAccount(int lockNoticeSettingAccountId, Map settingValue) => post( + updateLockNoticeSettingAccountURL.toUrl, + jsonEncode({'lockNoticeSettingAccountId': lockNoticeSettingAccountId, 'settingValue': settingValue})); // 获取胁迫指纹列表 - Future getCoercedFingerprintList( - int lockId, int pageNo, int pageSize, String searchStr) => - post( - getCoercedFingerprintListURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'pageNo': pageNo, - 'pageSize': pageSize, - 'searchStr': searchStr - })); + Future getCoercedFingerprintList(int lockId, int pageNo, int pageSize, String searchStr) => post( + getCoercedFingerprintListURL.toUrl, + jsonEncode({'lockId': lockId, 'pageNo': pageNo, 'pageSize': pageSize, 'searchStr': searchStr})); // 获取云存列表 Future getValidityPeriodInfo( @@ -2428,8 +2077,8 @@ class ApiProvider extends BaseProvider { post(getlockCloudStorageListURL.toUrl, jsonEncode({'lockId': lockId})); // 删除云存列表 - Future deleteLockCloudStorageList(List recordIds) => post( - deleteLockCloudStorageURL.toUrl, jsonEncode({'recordIds': recordIds})); + Future deleteLockCloudStorageList(List recordIds) => + post(deleteLockCloudStorageURL.toUrl, jsonEncode({'recordIds': recordIds})); // 设置微信公众号推送 Future setMpWechatPushSwitch(int mpWechatPushSwitch) => post( @@ -2439,8 +2088,7 @@ class ApiProvider extends BaseProvider { })); // 获取微信公众号二维码 - Future getMpWechatQrCode() => - post(getMpWechatQrCodeURL.toUrl, jsonEncode({})); + Future getMpWechatQrCode() => post(getMpWechatQrCodeURL.toUrl, jsonEncode({})); // 设置实名认证频次 Future setFaceAuthentication(int faceAuthFrequence) => post( @@ -2450,34 +2098,29 @@ class ApiProvider extends BaseProvider { })); // 获取购买记录列表 - Future getBuyRecordList( - String type, int recordType, int pageNo, int pageSize) => - post( - getBuyRecordListURL.toUrl, - jsonEncode({ - 'type': type, - 'record_type': recordType, - 'pageNo': pageNo, - 'pageSize': pageSize, - })); + Future getBuyRecordList(String type, int recordType, int pageNo, int pageSize) => post( + getBuyRecordListURL.toUrl, + jsonEncode({ + 'type': type, + 'record_type': recordType, + 'pageNo': pageNo, + 'pageSize': pageSize, + })); // 获取使用记录列表 - Future getUseRecordList(String type, int pageNo, int pageSize) => - post( - getUseRecordListURL.toUrl, - jsonEncode({ - 'type': type, - 'pageNo': pageNo, - 'pageSize': pageSize, - })); + Future getUseRecordList(String type, int pageNo, int pageSize) => post( + getUseRecordListURL.toUrl, + jsonEncode({ + 'type': type, + 'pageNo': pageNo, + 'pageSize': pageSize, + })); // 增值服务套餐购包链接 - Future getServicePackageBuyUrl() => - post(getServicePackageURL.toUrl, jsonEncode({})); + Future getServicePackageBuyUrl() => post(getServicePackageURL.toUrl, jsonEncode({})); // 获取增值服务用户余量包 - Future getServiceUserPackage() => - post(getServiceUserPackageURL.toUrl, jsonEncode({})); + Future getServiceUserPackage() => post(getServiceUserPackageURL.toUrl, jsonEncode({})); // 检测实名认证是否支持开启 Future keyCheckFace( @@ -2516,8 +2159,7 @@ class ApiProvider extends BaseProvider { })); // 获取指定锁下所有userNo - Future getLockUserNoList(int lockId) => - post(getUserNoList.toUrl, jsonEncode({'lockId': lockId})); + Future getLockUserNoList(int lockId) => post(getUserNoList.toUrl, jsonEncode({'lockId': lockId})); // 锁数据上传 Future lockDataUpload( @@ -2526,36 +2168,30 @@ class ApiProvider extends BaseProvider { int recordType, List records, bool isUnShowLoading, + bool isShowNetworkErrorMsg, ) => post( - lockDataUploadUrl.toUrl, - jsonEncode({ - 'lockId': lockId, - 'uploadType': uploadType, - 'recordType': recordType, - 'records': records - }), - isUnShowLoading: isUnShowLoading); + lockDataUploadUrl.toUrl, + jsonEncode({'lockId': lockId, 'uploadType': uploadType, 'recordType': recordType, 'records': records}), + isUnShowLoading: isUnShowLoading, + isShowNetworkErrorMsg: isShowNetworkErrorMsg, + ); // 获取短信或者邮箱模板 - Future> getNoticeTemplate( - int lockId, int keyId, int channelType) => - post( - getNoticeTemplateURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'keyId': keyId, - 'channelType': channelType, - })); + Future> getNoticeTemplate(int lockId, int keyId, int channelType) => post( + getNoticeTemplateURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'keyId': keyId, + 'channelType': channelType, + })); // 获取App基本信息 Future> getAppInfo() => - post(appGetAppInfoURL.toUrl, jsonEncode({}), - isShowErrMsg: false, isUnShowLoading: true); + post(appGetAppInfoURL.toUrl, jsonEncode({}), isShowErrMsg: false, isUnShowLoading: true); // 获取App固件信息 - Future> getFwVersion(String model, String currentVersion) => - post( + Future> getFwVersion(String model, String currentVersion) => post( appGetFwVersionURL.toUrl, jsonEncode({ 'model': model, @@ -2572,21 +2208,15 @@ class ApiProvider extends BaseProvider { ); // 获取短信模板列表 - Future> getSMSTemplateList( - int channelType, int pageNo, int pageSize) => - post( + Future> getSMSTemplateList(int channelType, int pageNo, int pageSize) => post( haveTemplateListURL.toUrl, - jsonEncode({ - 'channelType': channelType, - 'pageNo': pageNo, - 'pageSize': pageSize - }), + jsonEncode({'channelType': channelType, 'pageNo': pageNo, 'pageSize': pageSize}), isUnShowLoading: true, ); // 添加短信模板 - Future> addTemplateService(int channelType, String name, - int langType, String regards, String tips, int templateType) => + Future> addTemplateService( + int channelType, String name, int langType, String regards, String tips, int templateType) => post( addTemplateServiceURL.toUrl, jsonEncode({ @@ -2600,9 +2230,7 @@ class ApiProvider extends BaseProvider { isUnShowLoading: true, ); - Future> updateTemplateInfo( - int id, String name, String regards, String tips) => - post( + Future> updateTemplateInfo(int id, String name, String regards, String tips) => post( updateTemplateInfoURL.toUrl, jsonEncode({ 'id': id, @@ -2625,9 +2253,7 @@ class ApiProvider extends BaseProvider { isUnShowLoading: true, ); - Future> getKeyNoticeTemplate( - int lockId, int keyId, int channelType) => - post( + Future> getKeyNoticeTemplate(int lockId, int keyId, int channelType) => post( keyNoticeTemplateURL.toUrl, jsonEncode({ 'lockId': lockId, @@ -2637,9 +2263,7 @@ class ApiProvider extends BaseProvider { isUnShowLoading: true, ); - Future> getPwdNoticeTemplate( - int lockId, int keyboardPwdId, int channelType) => - post( + Future> getPwdNoticeTemplate(int lockId, int keyboardPwdId, int channelType) => post( keyNoticeTemplateURL.toUrl, jsonEncode({ 'lockId': lockId, @@ -2649,14 +2273,8 @@ class ApiProvider extends BaseProvider { isUnShowLoading: true, ); - Future> keyNoticeSubmit( - String receiverName, - int lockId, - int keyId, - int channelType, - int openDoorType, - String templateType, - int countryCode) => + Future> keyNoticeSubmit(String receiverName, int lockId, int keyId, int channelType, + int openDoorType, String templateType, int countryCode) => post( keyNoticeSubmitURL.toUrl, jsonEncode({ @@ -2671,14 +2289,8 @@ class ApiProvider extends BaseProvider { isUnShowLoading: true, ); - Future> pwdNoticeSubmit( - String receiverName, - int lockId, - int keyboardPwdId, - int channelType, - int openDoorType, - String templateType, - int countryCode) => + Future> pwdNoticeSubmit(String receiverName, int lockId, int keyboardPwdId, int channelType, + int openDoorType, String templateType, int countryCode) => post( keyNoticeSubmitURL.toUrl, jsonEncode({ diff --git a/lib/network/api_provider_base.dart b/lib/network/api_provider_base.dart index f50997f4..951905d4 100755 --- a/lib/network/api_provider_base.dart +++ b/lib/network/api_provider_base.dart @@ -50,31 +50,21 @@ class BaseProvider extends GetConnect with Api { httpClient.baseUrl = '${F.apiPrefix}/api'; } httpClient.timeout = timeout!.seconds; - // AppLog.log('timeout:$timeout httpClient.timeout:${httpClient.timeout}'); + var res = await super.post(url, body, - contentType: contentType, - headers: headers, - query: query, - decoder: decoder, - uploadProgress: uploadProgress); - debugPrint("====1===$url---> ${res.bodyString}"); + contentType: contentType, headers: headers, query: query, decoder: decoder, uploadProgress: uploadProgress); + if (EasyLoading.isShow && !isUnShowLoading!) { await EasyLoading.dismiss(animation: true); } - debugPrint("===2====$url---> ${res.bodyString}"); + if (res.body == null) { // EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); if (res.statusCode == null && isShowErrMsg!) { - EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, - duration: 2000.milliseconds); + EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 2000.milliseconds); // EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); } - var rs = { - 'errorMsg': 'Network Error!', - 'errorCode': -1, - 'data': null, - 'description': '表示成功或是。' - }; + var rs = {'errorMsg': 'Network Error!', 'errorCode': -1, 'data': null, 'description': '表示成功或是。'}; return Response( request: res.request, statusCode: -1, @@ -84,6 +74,7 @@ class BaseProvider extends GetConnect with Api { statusText: res.statusText, ); } else {} + print('isShowNetworkErrorMsg:${isShowNetworkErrorMsg}'); if (isShowNetworkErrorMsg ?? true) { getDataResult(res.body); } @@ -111,25 +102,15 @@ class BaseProvider extends GetConnect with Api { } else { httpClient.baseUrl = '${F.apiPrefix}/api'; } - var res = await super.get(url, - contentType: contentType, - headers: headers, - query: query, - decoder: decoder); + var res = await super.get(url, contentType: contentType, headers: headers, query: query, decoder: decoder); if (EasyLoading.isShow && !isUnShowLoading!) { await EasyLoading.dismiss(animation: true); } if (res.body == null) { if (res.statusCode == null && isShowErrMsg!) { - EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, - duration: 2000.milliseconds); + EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 2000.milliseconds); } - var rs = { - 'errorMsg': 'Network Error!', - 'errorCode': -1, - 'data': null, - 'description': '表示成功或是。' - }; + var rs = {'errorMsg': 'Network Error!', 'errorCode': -1, 'data': null, 'description': '表示成功或是。'}; return Response( request: res.request, statusCode: -1, @@ -166,8 +147,7 @@ class BaseProvider extends GetConnect with Api { EasyLoading.showToast('数据不存在'.tr, duration: 2000.milliseconds); break; case 434: //与后台约定弹出确认框提示 - ShowTipView() - .showSureBtnTipsAlert(tipsText: T['errorMsg'], sureText: ''); + ShowTipView().showSureBtnTipsAlert(tipsText: T['errorMsg'], sureText: ''); break; } } diff --git a/lib/network/api_repository.dart b/lib/network/api_repository.dart index b9ecd53e..01343a41 100755 --- a/lib/network/api_repository.dart +++ b/lib/network/api_repository.dart @@ -102,8 +102,7 @@ class ApiRepository { required String channel, required String codeType, required String xWidth}) async { - final res = await apiProvider.sendValidationCode( - countryCode, account, channel, codeType, xWidth); + final res = await apiProvider.sendValidationCode(countryCode, account, channel, codeType, xWidth); return SendValidationCodeEntity.fromJson(res.body); } @@ -115,23 +114,19 @@ class ApiRepository { required String password, required String verificationCode, required Map deviceInfo}) async { - final res = await apiProvider.register(receiverType, countryCode, account, - password, verificationCode, deviceInfo); + final res = await apiProvider.register(receiverType, countryCode, account, password, verificationCode, deviceInfo); return LoginEntity.fromJson(res.body); } // 获取图片验证码 - Future getSliderVerifyImg( - String countryCode, String account) async { + Future getSliderVerifyImg(String countryCode, String account) async { final res = await apiProvider.getSliderVerifyImg(countryCode, account); return SafetyVerificationEntity.fromJson(res.body); } // 检验图片验证码 - Future checkSliderVerifyImg( - String countryCode, String account, String xWidth) async { - final res = - await apiProvider.checkSliderVerifyImg(countryCode, account, xWidth); + Future checkSliderVerifyImg(String countryCode, String account, String xWidth) async { + final res = await apiProvider.checkSliderVerifyImg(countryCode, account, xWidth); return CheckSafetyVerificationEntity.fromJson(res.body); } @@ -142,31 +137,21 @@ class ApiRepository { required String countryCode, required String username, required Map deviceInfo}) async { - final res = await apiProvider.login( - loginType, password, countryCode, username, deviceInfo); + final res = await apiProvider.login(loginType, password, countryCode, username, deviceInfo); return LoginEntity.fromJson(res.body); } //登录 Future oneClickLogin( - {required String loginType, - required String loginToken, - required Map deviceInfo}) async { - final res = - await apiProvider.oneClickLogin(loginType, loginToken, deviceInfo); + {required String loginType, required String loginToken, required Map deviceInfo}) async { + final res = await apiProvider.oneClickLogin(loginType, loginToken, deviceInfo); return LoginEntity.fromJson(res.body); } //重置密码 - Future resetPassword( - String countryCode, - String account, - String date, - String newPassword, - String uniqueid, - String verificationCode) async { - final res = await apiProvider.resetPassword( - countryCode, account, date, newPassword, uniqueid, verificationCode); + Future resetPassword(String countryCode, String account, String date, String newPassword, + String uniqueid, String verificationCode) async { + final res = await apiProvider.resetPassword(countryCode, account, date, newPassword, uniqueid, verificationCode); return LoginEntity.fromJson(res.body); } @@ -188,14 +173,13 @@ class ApiRepository { required String startDate, required String searchStr, }) async { - final res = await apiProvider.electronicKeyList(endDate, keyId, keyStatus, - keyRight, lockId, pageNo, pageSize, startDate, searchStr); + final res = await apiProvider.electronicKeyList( + endDate, keyId, keyStatus, keyRight, lockId, pageNo, pageSize, startDate, searchStr); return ElectronicKeyListEntity.fromJson(res.body); } //获取电子钥匙 - Future electronicKey( - {required int lockId, required int keyId}) async { + Future electronicKey({required int lockId, required int keyId}) async { final res = await apiProvider.electronicKey(lockId, keyId); return ElectronicKeyEntity.fromJson(res.body); } @@ -249,8 +233,7 @@ class ApiRepository { } //重置电子钥匙 - Future resetElectronicKey( - String lockId, String operatorUid) async { + Future resetElectronicKey(String lockId, String operatorUid) async { final res = await apiProvider.resetElectronicKey(lockId, operatorUid); return ElectronicKeyListEntity.fromJson(res.body); } @@ -312,15 +295,13 @@ class ApiRepository { } //操作记录上传 - Future lockRecordUploadData( - {required String lockId, required List records}) async { + Future lockRecordUploadData({required String lockId, required List records}) async { final res = await apiProvider.lockRecordUploadData(lockId, records); return KeyOperationRecordEntity.fromJson(res.body); } // 查询锁记录最后时间 - Future - getLockRecordLastUploadDataTime({required String lockId}) async { + Future getLockRecordLastUploadDataTime({required String lockId}) async { final res = await apiProvider.getLockRecordLastUploadDataTime(lockId); return LockOperatingRecordGetLastRecordTimeEntity.fromJson(res.body); } @@ -332,15 +313,13 @@ class ApiRepository { } // 更新锁用户NO - Future updateLockUserNo( - {required String keyId, required String lockUserNo}) async { + Future updateLockUserNo({required String keyId, required String lockUserNo}) async { final res = await apiProvider.updateLockUserNo(keyId, lockUserNo); return LockNetTokenEntity.fromJson(res.body); } // 更新锁用户 InitUserNo - Future updateLockInitUserNo( - {required int lockId, required int initUserNo}) async { + Future updateLockInitUserNo({required int lockId, required int initUserNo}) async { final res = await apiProvider.updateLockInitUserNo(lockId, initUserNo); return LockNetTokenEntity.fromJson(res.body); } @@ -356,16 +335,8 @@ class ApiRepository { required String featureValue, required String featureSettingValue, required List featureSettingParams}) async { - final res = await apiProvider.bindingBlueAdmin( - lockAlias, - position, - bluetooth, - lockInfo, - lockUserNo, - pwdTimestamp, - featureValue, - featureSettingValue, - featureSettingParams); + final res = await apiProvider.bindingBlueAdmin(lockAlias, position, bluetooth, lockInfo, lockUserNo, pwdTimestamp, + featureValue, featureSettingValue, featureSettingParams); return SaveLockEntity.fromJson(res.body); } @@ -382,16 +353,13 @@ class ApiRepository { //锁名称修改 Future modifyKeyName( - {required String keyId, - required String lockId, - required String keyName}) async { + {required String keyId, required String lockId, required String keyName}) async { final res = await apiProvider.modifyKeyName(keyId, lockId, keyName); return KeyOperationRecordEntity.fromJson(res.body); } //修改锁名(新) - Future updateLockName( - {required String lockId, required String lockName}) async { + Future updateLockName({required String lockId, required String lockName}) async { final res = await apiProvider.updateLockName(lockId, lockName); return LoginEntity.fromJson(res.body); } @@ -402,8 +370,7 @@ class ApiRepository { String keyNameForAdmin, String operatorUid, ) async { - final res = await apiProvider.modifyKeyNameForAdmin( - keyId, keyNameForAdmin, operatorUid); + final res = await apiProvider.modifyKeyNameForAdmin(keyId, keyNameForAdmin, operatorUid); return KeyOperationRecordEntity.fromJson(res.body); } @@ -420,16 +387,7 @@ class ApiRepository { required int isOnlyManageSelf, required int remoteEnable}) async { final res = await apiProvider.updateKeyDate( - keyId, - lockId, - endDate, - startDate, - weekDays, - keyType, - startTime, - endTime, - isOnlyManageSelf, - remoteEnable); + keyId, lockId, endDate, startDate, weekDays, keyType, startTime, endTime, isOnlyManageSelf, remoteEnable); return KeyOperationRecordEntity.fromJson(res.body); } @@ -441,16 +399,14 @@ class ApiRepository { required int faceAuthentication, required String realName, required String idCardNumber}) async { - final res = await apiProvider.updateRealNameInfo( - lockId, keyId, uid, faceAuthentication, realName, idCardNumber); + final res = await apiProvider.updateRealNameInfo(lockId, keyId, uid, faceAuthentication, realName, idCardNumber); return KeyOperationRecordEntity.fromJson(res.body); } //密码列表 - Future passwordKeyList(String keyStatus, String lockId, - String pageNo, String pageSize, String searchStr) async { - final res = await apiProvider.passwordKeyList( - keyStatus, lockId, pageNo, pageSize, searchStr); + Future passwordKeyList( + String keyStatus, String lockId, String pageNo, String pageSize, String searchStr) async { + final res = await apiProvider.passwordKeyList(keyStatus, lockId, pageNo, pageSize, searchStr); return PasswordKeyListEntity.fromJson(res.body); } @@ -461,8 +417,7 @@ class ApiRepository { } //重置密码钥匙 - Future resetPasswordKey( - String lockId, String operatorUid) async { + Future resetPasswordKey(String lockId, String operatorUid) async { final res = await apiProvider.resetPasswordKey(lockId, operatorUid); return PasswordKeyListEntity.fromJson(res.body); } @@ -476,24 +431,19 @@ class ApiRepository { // 获取锁信息列表 Future getStarLockListInfo( - {required int pageNo, - required int pageSize, - required bool isUnShowLoading}) async { - final res = await apiProvider.getStarLockListInfo(pageNo, pageSize, - isUnShowLoading: isUnShowLoading); + {required int pageNo, required int pageSize, required bool isUnShowLoading}) async { + final res = await apiProvider.getStarLockListInfo(pageNo, pageSize, isUnShowLoading: isUnShowLoading); return LockListInfoEntity.fromJson(res.body); } // 获取锁信息列表 Future getStarLockInfo({required int keyId}) async { - final res = await apiProvider.getStarLockListInfo(1, 20, - isUnShowLoading: true, keyId: keyId); + final res = await apiProvider.getStarLockListInfo(1, 20, isUnShowLoading: true, keyId: keyId); return LockListInfoEntity.fromJson(res.body); } // 获取所有锁设置信息 - Future getLockSettingInfoData( - {required String lockId, bool isUnShowLoading = false}) async { + Future getLockSettingInfoData({required String lockId, bool isUnShowLoading = false}) async { final res = await apiProvider.getLockSettingInfoData( lockId, isUnShowLoading: isUnShowLoading, @@ -502,10 +452,8 @@ class ApiRepository { } // 获取所有锁设置信息(不显示加载框) - Future getLockSettingInfoDataIsNotLoadingIcon( - {required String lockId}) async { - final res = - await apiProvider.getLockSettingInfoDataIsNotLoadingIcon(lockId); + Future getLockSettingInfoDataIsNotLoadingIcon({required String lockId}) async { + final res = await apiProvider.getLockSettingInfoDataIsNotLoadingIcon(lockId); return LockSetInfoEntity.fromJson(res.body); } @@ -517,17 +465,13 @@ class ApiRepository { // 删除钥匙 Future deletOwnerKeyData( - {required String lockId, - required String keyId, - required int includeUnderlings}) async { - final res = - await apiProvider.deletOwnerKeyInfo(lockId, keyId, includeUnderlings); + {required String lockId, required String keyId, required int includeUnderlings}) async { + final res = await apiProvider.deletOwnerKeyInfo(lockId, keyId, includeUnderlings); return LockListInfoEntity.fromJson(res.body); } // 检查账户密码 - Future checkLoginPassword( - {required String password}) async { + Future checkLoginPassword({required String password}) async { final res = await apiProvider.checkLoginPassword(password); return LockListInfoEntity.fromJson(res.body); } @@ -542,18 +486,15 @@ class ApiRepository { required int startHours, required int endHours, required int isCoerced}) async { - final res = await apiProvider.getKeyboardPwd(endDate, keyboardPwdName, - keyboardPwdType, lockId, startDate, startHours, endHours, isCoerced); + final res = await apiProvider.getKeyboardPwd( + endDate, keyboardPwdName, keyboardPwdType, lockId, startDate, startHours, endHours, isCoerced); return PasswordKeyEntity.fromJson(res.body); } // 更新锁用户序号 Future updatePWDNumber( - {required String lockId, - required String keyboardPwdId, - required String pwdUserNo}) async { - final res = - await apiProvider.updatePWDNumber(lockId, keyboardPwdId, pwdUserNo); + {required String lockId, required String keyboardPwdId, required String pwdUserNo}) async { + final res = await apiProvider.updatePWDNumber(lockId, keyboardPwdId, pwdUserNo); return PasswordKeyEntity.fromJson(res.body); } @@ -568,18 +509,15 @@ class ApiRepository { required String addType, required int pwdRight, }) async { - final res = await apiProvider.addKeyboardPwd(lockId, keyboardPwdName, - keyboardPwd, keyboardPwdType, startDate, endDate, addType, pwdRight); + final res = await apiProvider.addKeyboardPwd( + lockId, keyboardPwdName, keyboardPwd, keyboardPwdType, startDate, endDate, addType, pwdRight); return PasswordKeyEntity.fromJson(res.body); } //自定义密码校验密码名称或密码是否已存在 Future checkKeyboardpwdName( - {required String lockId, - required String keyboardPwdName, - required String keyboardPwd}) async { - final res = await apiProvider.checkKeyboardpwdName( - lockId, keyboardPwdName, keyboardPwd); + {required String lockId, required String keyboardPwdName, required String keyboardPwd}) async { + final res = await apiProvider.checkKeyboardpwdName(lockId, keyboardPwdName, keyboardPwd); return PasswordKeyEntity.fromJson(res.body); } @@ -597,19 +535,8 @@ class ApiRepository { required int hoursEnd, required int keyboardPwdType, required int pwdRight}) async { - final res = await apiProvider.updateKeyboardPwd( - lockId, - keyboardPwdId, - keyboardPwdName, - newKeyboardPwd, - startDate, - endDate, - changeType, - isCoerced, - hoursStart, - hoursEnd, - keyboardPwdType, - pwdRight); + final res = await apiProvider.updateKeyboardPwd(lockId, keyboardPwdId, keyboardPwdName, newKeyboardPwd, startDate, + endDate, changeType, isCoerced, hoursStart, hoursEnd, keyboardPwdType, pwdRight); return PasswordKeyEntity.fromJson(res.body); } @@ -620,22 +547,19 @@ class ApiRepository { } //创建锁分组 - Future addLockGroup( - String groupName, String operatorUid) async { + Future addLockGroup(String groupName, String operatorUid) async { final res = await apiProvider.addLockGroup(groupName, operatorUid); return MassSendLockGroupListEntity.fromJson(res.body); } // 编辑锁名字 - Future editLockGroupRequest( - {required int groupId, required String groupName}) async { + Future editLockGroupRequest({required int groupId, required String groupName}) async { final res = await apiProvider.editLockGroupRequest(groupId, groupName); return MassSendLockGroupListEntity.fromJson(res.body); } //设置锁分组 - Future setLockGroup( - String lockId, String groupId) async { + Future setLockGroup(String lockId, String groupId) async { final res = await apiProvider.setLockGroup(lockId, groupId); return MassSendLockGroupListEntity.fromJson(res.body); } @@ -653,15 +577,13 @@ class ApiRepository { } //锁分组里面添加锁 - Future lockGroupAddLock( - {required List lockIds, required int groupId}) async { + Future lockGroupAddLock({required List lockIds, required int groupId}) async { final res = await apiProvider.lockGroupAddLock(lockIds, groupId); return MassSendLockGroupListEntity.fromJson(res.body); } //锁分组里面删除锁 - Future lockGroupDeletLock( - {required List lockIds}) async { + Future lockGroupDeletLock({required List lockIds}) async { final res = await apiProvider.lockGroupDeletLock(lockIds); return MassSendLockGroupListEntity.fromJson(res.body); } @@ -679,15 +601,13 @@ class ApiRepository { } //删除电子钥匙 - Future deleteElectronicKey( - {required String keyId, required int includeUnderlings}) async { + Future deleteElectronicKey({required String keyId, required int includeUnderlings}) async { final res = await apiProvider.deleteElectronicKey(keyId, includeUnderlings); return ElectronicKeyListEntity.fromJson(res.body); } //删除授权管理员 - Future deleteAdministrator( - String uid, String includeUnderlings) async { + Future deleteAdministrator(String uid, String includeUnderlings) async { final res = await apiProvider.deleteAdministrator(uid, includeUnderlings); return ElectronicKeyListEntity.fromJson(res.body); } @@ -701,28 +621,24 @@ class ApiRepository { required int isOnlyManageSelf, required int keyType, }) async { - final res = await apiProvider.updateAdministrator( - uid, keyName, endDate, startDate, isOnlyManageSelf, keyType); + final res = await apiProvider.updateAdministrator(uid, keyName, endDate, startDate, isOnlyManageSelf, keyType); return AdministratorDetailEntity.fromJson(res.body); } //设置授权管理员 - Future setAdministrator( - {required String keyId}) async { + Future setAdministrator({required String keyId}) async { final res = await apiProvider.setAdministrator(keyId); return ElectronicKeyListEntity.fromJson(res.body); } //取消授权管理员 - Future cancelAdministrator( - {required String keyId}) async { + Future cancelAdministrator({required String keyId}) async { final res = await apiProvider.cancelAdministrator(keyId); return ElectronicKeyListEntity.fromJson(res.body); } //冻结 - Future freezeKey( - {required String keyId, required int includeUnderlings}) async { + Future freezeKey({required String keyId, required int includeUnderlings}) async { final res = await apiProvider.freezeKey(keyId, includeUnderlings); return ElectronicKeyListEntity.fromJson(res.body); } @@ -737,47 +653,39 @@ class ApiRepository { } //即将到期的电子钥匙列表 - Future expireLockList( - String pageNo, String pageSize) async { + Future expireLockList(String pageNo, String pageSize) async { final res = await apiProvider.expireLockList(pageNo, pageSize); return ExpireLockListEntity.fromJson(res.body); } //即将到期的密码列表 - Future expirePasswordList( - String pageNo, String pageSize) async { + Future expirePasswordList(String pageNo, String pageSize) async { final res = await apiProvider.expirePasswordList(pageNo, pageSize); return ExpirePasswordEntity.fromJson(res.body); } //即将到期的卡列表 - Future expireCardList( - String pageNo, String pageSize) async { + Future expireCardList(String pageNo, String pageSize) async { final res = await apiProvider.expireCardList(pageNo, pageSize); return ExpireCardEntity.fromJson(res.body); } //即将到期的指纹列表 - Future expireFingerprintList( - String pageNo, String pageSize) async { + Future expireFingerprintList(String pageNo, String pageSize) async { final res = await apiProvider.expireFingerprintList(pageNo, pageSize); return ExpireFingerprintEntity.fromJson(res.body); } //即将到期的人脸列表 - Future expireFaceList( - String pageNo, String pageSize) async { + Future expireFaceList(String pageNo, String pageSize) async { final res = await apiProvider.expireFaceList(pageNo, pageSize); return ExpireFaceEntity.fromJson(res.body); } //删除密码 Future deleteKeyboardPwd( - {required String lockId, - required String keyboardPwdId, - required int deleteType}) async { - final res = - await apiProvider.deleteKeyboardPwd(lockId, keyboardPwdId, deleteType); + {required String lockId, required String keyboardPwdId, required int deleteType}) async { + final res = await apiProvider.deleteKeyboardPwd(lockId, keyboardPwdId, deleteType); return PasswordKeyEntity.fromJson(res.body); } @@ -807,8 +715,7 @@ class ApiRepository { required int autoLock, required int autoLockSecond, }) async { - final res = await apiProvider.setAutoUnlockLoadData( - lockId, autoLock, autoLockSecond); + final res = await apiProvider.setAutoUnlockLoadData(lockId, autoLock, autoLockSecond); return LoginEntity.fromJson(res.body); } @@ -827,8 +734,7 @@ class ApiRepository { required int lockSound, required int lockSoundVolume, }) async { - final res = - await apiProvider.setLockSoundData(lockId, lockSound, lockSoundVolume); + final res = await apiProvider.setLockSoundData(lockId, lockSound, lockSoundVolume); return LoginEntity.fromJson(res.body); } @@ -846,8 +752,7 @@ class ApiRepository { required int lockId, required int remoteUnlock, }) async { - final res = await apiProvider.remoteUnlockingOpenOrCloseLoadData( - lockId, remoteUnlock); + final res = await apiProvider.remoteUnlockingOpenOrCloseLoadData(lockId, remoteUnlock); return LoginEntity.fromJson(res.body); } @@ -874,8 +779,7 @@ class ApiRepository { required int lockId, required int appUnlockOnline, }) async { - final res = - await apiProvider.setOpenLockNeedOnlineData(lockId, appUnlockOnline); + final res = await apiProvider.setOpenLockNeedOnlineData(lockId, appUnlockOnline); return LoginEntity.fromJson(res.body); } @@ -884,8 +788,7 @@ class ApiRepository { required int lockId, required int openDirectionValue, }) async { - final res = - await apiProvider.setOpenDoorDirectionData(lockId, openDirectionValue); + final res = await apiProvider.setOpenDoorDirectionData(lockId, openDirectionValue); return LoginEntity.fromJson(res.body); } @@ -913,8 +816,7 @@ class ApiRepository { required int passageMode, required List passageModeConfig, }) async { - final res = await apiProvider.setNormallyModeData( - lockId, passageMode, passageModeConfig); + final res = await apiProvider.setNormallyModeData(lockId, passageMode, passageModeConfig); return LoginEntity.fromJson(res.body); } @@ -948,10 +850,8 @@ class ApiRepository { } // 获取服务器当前时间 - Future getServerDatetimeData( - {bool? isUnShowLoading}) async { - final res = - await apiProvider.getServerDatetimeLoadData(isUnShowLoading ?? true); + Future getServerDatetimeData({bool? isUnShowLoading}) async { + final res = await apiProvider.getServerDatetimeLoadData(isUnShowLoading ?? true); return GetServerDatetimeEntity.fromJson(res.body); } @@ -967,14 +867,7 @@ class ApiRepository { required String timestamp, }) async { final res = await apiProvider.setLockDiagnoseData( - lockId, - electricQuantity, - firmwareRevision, - hardwareRevision, - lockDate, - modelNum, - pwdInfo, - timestamp); + lockId, electricQuantity, firmwareRevision, hardwareRevision, lockDate, modelNum, pwdInfo, timestamp); return LoginEntity.fromJson(res.body); } @@ -987,8 +880,7 @@ class ApiRepository { } //分组下的锁列表 - Future listLockByGroup( - String type, String keyGroupId) async { + Future listLockByGroup(String type, String keyGroupId) async { final res = await apiProvider.listLockByGroup(type, keyGroupId); return MassSendLockGroupListEntity.fromJson(res.body); } @@ -1000,8 +892,7 @@ class ApiRepository { } //锁用户列表 - Future lockUserList( - String pageNo, String pageSize, String searchStr) async { + Future lockUserList(String pageNo, String pageSize, String searchStr) async { final res = await apiProvider.lockUserList(pageNo, pageSize, searchStr); return LockUserListEntity.fromJson(res.body); } @@ -1013,8 +904,7 @@ class ApiRepository { } //用户拥有的钥匙 - Future keyListByUser( - String pageNo, String pageSize, String uid) async { + Future keyListByUser(String pageNo, String pageSize, String uid) async { final res = await apiProvider.keyListByUser(pageNo, pageSize, uid); return KeyListByUserEntity.fromJson(res.body); } @@ -1041,21 +931,8 @@ class ApiRepository { required int remoteUnlockSwitch, required int keyRight, required bool isShowNetworkErrorMsg}) async { - final res = await apiProvider.batchSendKey( - lockIds, - createUser, - countryCode, - receiverUsername, - keyName, - keyType, - weekDays, - startDate, - endDate, - startTime, - endTime, - remoteUnlockSwitch, - keyRight, - isShowNetworkErrorMsg); + final res = await apiProvider.batchSendKey(lockIds, createUser, countryCode, receiverUsername, keyName, keyType, + weekDays, startDate, endDate, startTime, endTime, remoteUnlockSwitch, keyRight, isShowNetworkErrorMsg); return KeyDetailEntity.fromJson(res.body); } @@ -1072,24 +949,13 @@ class ApiRepository { required String countryCode, required String usernameType, required int isOnlyManageSelf}) async { - final res = await apiProvider.addAuthorizedAdmin( - createUser, - endDate, - isRemoteUnlock, - keyGroupIdList, - lockIdList, - name, - startDate, - userid, - countryCode, - usernameType, - isOnlyManageSelf); + final res = await apiProvider.addAuthorizedAdmin(createUser, endDate, isRemoteUnlock, keyGroupIdList, lockIdList, + name, startDate, userid, countryCode, usernameType, isOnlyManageSelf); return KeyDetailEntity.fromJson(res.body); } //授权管理员列表 - Future authorizedAdminList( - String pageNo, String pageSize) async { + Future authorizedAdminList(String pageNo, String pageSize) async { final res = await apiProvider.authorizedAdminList(pageNo, pageSize); return AuthorizedAdminListEntity.fromJson(res.body); } @@ -1101,34 +967,26 @@ class ApiRepository { } //获取授权管理员下锁列表 - Future administratorOwnLockList( - {required int uid}) async { + Future administratorOwnLockList({required int uid}) async { final res = await apiProvider.administratorOwnLockList(uid); return AdministratorAssociationLockEntity.fromJson(res.body); } //删除授权管理员 - Future deleteAuthorizedAdmin( - String uid, String includeUnderlings) async { + Future deleteAuthorizedAdmin(String uid, String includeUnderlings) async { final res = await apiProvider.deleteAuthorizedAdmin(uid, includeUnderlings); return AuthorizedAdminListEntity.fromJson(res.body); } //更新授权管理员 Future updateAuthorizedAdmin( - String uid, - String name, - String endDate, - String startDate, - String isRemoteUnlock) async { - final res = await apiProvider.updateAuthorizedAdmin( - uid, name, endDate, startDate, isRemoteUnlock); + String uid, String name, String endDate, String startDate, String isRemoteUnlock) async { + final res = await apiProvider.updateAuthorizedAdmin(uid, name, endDate, startDate, isRemoteUnlock); return AuthorizedAdminListEntity.fromJson(res.body); } //提示音 - Future setAlertMode( - String alertMode, String isOn) async { + Future setAlertMode(String alertMode, String isOn) async { final res = await apiProvider.setAlertMode(alertMode, isOn); return ExpireLockListEntity.fromJson(res.body); } @@ -1152,8 +1010,7 @@ class ApiRepository { } // 开启考勤 获取考勤信息 - Future openCheckingInData( - {required String lockId}) async { + Future openCheckingInData({required String lockId}) async { final res = await apiProvider.openCheckingInGetData(lockId); return CheckingInInfoDataEntity.fromJson(res.body); } @@ -1166,14 +1023,13 @@ class ApiRepository { required List workDay, required String workEndTime, required String workStartTime}) async { - final res = await apiProvider.setCheckInCreateCompanyData(lockId, - attendanceType, companyName, workDay, workEndTime, workStartTime); + final res = await apiProvider.setCheckInCreateCompanyData( + lockId, attendanceType, companyName, workDay, workEndTime, workStartTime); return LoginEntity.fromJson(res.body); } // 删除公司 - Future deletCompanyData( - {required int companyId}) async { + Future deletCompanyData({required int companyId}) async { final res = await apiProvider.deletCompanyData(companyId); return CheckingInInfoDataEntity.fromJson(res.body); } @@ -1183,8 +1039,7 @@ class ApiRepository { required int lockId, required int unlockReminder, }) async { - final res = - await apiProvider.setLockPickingReminderData(lockId, unlockReminder); + final res = await apiProvider.setLockPickingReminderData(lockId, unlockReminder); return LoginEntity.fromJson(res.body); } @@ -1193,8 +1048,7 @@ class ApiRepository { required String companyId, required String attendanceDate, }) async { - final res = await apiProvider.getCheckInListEarlyArrivalWithDateData( - companyId, attendanceDate); + final res = await apiProvider.getCheckInListEarlyArrivalWithDateData(companyId, attendanceDate); return CheckingInListDayEntity.fromJson(res.body); } @@ -1203,8 +1057,7 @@ class ApiRepository { required String companyId, required String attendanceDate, }) async { - final res = await apiProvider.getCheckInListEarlyArrivalWithMonthData( - companyId, attendanceDate); + final res = await apiProvider.getCheckInListEarlyArrivalWithMonthData(companyId, attendanceDate); return CheckingInListMonthEntity.fromJson(res.body); } @@ -1213,8 +1066,7 @@ class ApiRepository { required String companyId, required String attendanceDate, }) async { - final res = await apiProvider.getCheckInListLateTimesWithDateData( - companyId, attendanceDate); + final res = await apiProvider.getCheckInListLateTimesWithDateData(companyId, attendanceDate); return CheckingInListDayEntity.fromJson(res.body); } @@ -1223,8 +1075,7 @@ class ApiRepository { required String companyId, required String attendanceDate, }) async { - final res = await apiProvider.getCheckInListLateTimesWithMonthData( - companyId, attendanceDate); + final res = await apiProvider.getCheckInListLateTimesWithMonthData(companyId, attendanceDate); return CheckingInListMonthEntity.fromJson(res.body); } @@ -1234,8 +1085,7 @@ class ApiRepository { required String attendanceDate, required String type, }) async { - final res = await apiProvider.getCheckInListHardworkingData( - companyId, attendanceDate, type); + final res = await apiProvider.getCheckInListHardworkingData(companyId, attendanceDate, type); return CheckingInListMonthEntity.fromJson(res.body); } @@ -1245,8 +1095,7 @@ class ApiRepository { required String attendanceDate, required String staffId, }) async { - final res = await apiProvider.getCheckInDetailData( - companyId, attendanceDate, staffId); + final res = await apiProvider.getCheckInDetailData(companyId, attendanceDate, staffId); return CheckingInDetailEntity.fromJson(res.body); } @@ -1260,10 +1109,7 @@ class ApiRepository { } // 删除员工 - Future deletStaffData( - {required int lockId, - required int staffId, - required int deleteKey}) async { + Future deletStaffData({required int lockId, required int staffId, required int deleteKey}) async { final res = await apiProvider.deletStaffData(lockId, staffId, deleteKey); return LoginEntity.fromJson(res.body); } @@ -1278,8 +1124,8 @@ class ApiRepository { required String countryCode, required String usernameType, }) async { - final res = await apiProvider.addStaffData(attendanceType, attendanceWay, - companyId, have, staffName, countryCode, usernameType); + final res = await apiProvider.addStaffData( + attendanceType, attendanceWay, companyId, have, staffName, countryCode, usernameType); return LoginEntity.fromJson(res.body); } @@ -1293,8 +1139,8 @@ class ApiRepository { required String countryCode, required String usernameType, }) async { - final res = await apiProvider.editStaffData(attendanceType, attendanceWay, - staffId, have, staffName, countryCode, usernameType); + final res = await apiProvider.editStaffData( + attendanceType, attendanceWay, staffId, have, staffName, countryCode, usernameType); return LoginEntity.fromJson(res.body); } @@ -1315,8 +1161,8 @@ class ApiRepository { required String vacationName, required String vacationStartDate, }) async { - final res = await apiProvider.addHolidaysData(companyId, fillClassDate, - vacationEndDate, vacationName, vacationStartDate); + final res = + await apiProvider.addHolidaysData(companyId, fillClassDate, vacationEndDate, vacationName, vacationStartDate); return LoginEntity.fromJson(res.body); } @@ -1353,8 +1199,8 @@ class ApiRepository { required String workStartTime, required List workDay, }) async { - final res = await apiProvider.editCheckInSetInfoData(attendanceType, - companyId, type, companyName, workEndTime, workStartTime, workDay); + final res = await apiProvider.editCheckInSetInfoData( + attendanceType, companyId, type, companyName, workEndTime, workStartTime, workDay); return LoginEntity.fromJson(res.body); } @@ -1365,8 +1211,7 @@ class ApiRepository { required String pageSize, required String searchStr, }) async { - final res = await apiProvider.getFingerprintsListData( - lockId, pageNo, pageSize, searchStr); + final res = await apiProvider.getFingerprintsListData(lockId, pageNo, pageSize, searchStr); return FingerprintListDataEntity.fromJson(res.body); } @@ -1391,19 +1236,8 @@ class ApiRepository { required int startTime, required int endTime, }) async { - final res = await apiProvider.addFingerprintsData( - lockId, - endDate, - addType, - fingerprintName, - fingerprintNumber, - fingerprintType, - isCoerced, - startDate, - weekDay, - fingerRight, - startTime, - endTime); + final res = await apiProvider.addFingerprintsData(lockId, endDate, addType, fingerprintName, fingerprintNumber, + fingerprintType, isCoerced, startDate, weekDay, fingerRight, startTime, endTime); return AddFingerprintEntity.fromJson(res.body); } @@ -1421,48 +1255,29 @@ class ApiRepository { required int endTime, required int fingerprintType, required int fingerRight}) async { - final res = await apiProvider.editFingerprintsData( - fingerprintId, - lockId, - weekDay, - startDate, - endDate, - isCoerced, - fingerprintName, - changeType, - startTime, - endTime, - fingerprintType, - fingerRight); + final res = await apiProvider.editFingerprintsData(fingerprintId, lockId, weekDay, startDate, endDate, isCoerced, + fingerprintName, changeType, startTime, endTime, fingerprintType, fingerRight); return LoginEntity.fromJson(res.body); } // 删除指纹 Future deletFingerprintsData( - {required String fingerprintId, - required String lockId, - required String type, - required String deleteType}) async { - final res = await apiProvider.deletFingerprintsData( - fingerprintId, lockId, type, deleteType); + {required String fingerprintId, required String lockId, required String type, required String deleteType}) async { + final res = await apiProvider.deletFingerprintsData(fingerprintId, lockId, type, deleteType); return LoginEntity.fromJson(res.body); } // 更新指纹用户序号 Future updateFingerprintUserNoLoadData( - {required String fingerprintId, - required String lockId, - required String fingerprintUserNo}) async { - final res = await apiProvider.updateFingerprintUserNoLoadData( - fingerprintId, lockId, fingerprintUserNo); + {required String fingerprintId, required String lockId, required String fingerprintUserNo}) async { + final res = await apiProvider.updateFingerprintUserNoLoadData(fingerprintId, lockId, fingerprintUserNo); return LoginEntity.fromJson(res.body); } // 校验指纹名字是否重复 Future checkFingerprintNameDuplicatedData( {required String lockId, required String fingerprintName}) async { - final res = await apiProvider.checkFingerprintNameDuplicatedData( - lockId, fingerprintName); + final res = await apiProvider.checkFingerprintNameDuplicatedData(lockId, fingerprintName); return LoginEntity.fromJson(res.body); } @@ -1473,8 +1288,7 @@ class ApiRepository { required String pageSize, required String searchStr, }) async { - final res = - await apiProvider.getFaceListData(lockId, pageNo, pageSize, searchStr); + final res = await apiProvider.getFaceListData(lockId, pageNo, pageSize, searchStr); return FingerprintListDataEntity.fromJson(res.body); } @@ -1492,43 +1306,25 @@ class ApiRepository { required int startTime, required int endTime, required int faceRight}) async { - final res = await apiProvider.addFaceData( - lockId, - faceName, - faceNumber, - faceType, - startDate, - endDate, - featureData, - addType, - weekDay, - startTime, - endTime, - faceRight); + final res = await apiProvider.addFaceData(lockId, faceName, faceNumber, faceType, startDate, endDate, featureData, + addType, weekDay, startTime, endTime, faceRight); return AddFaceEntity.fromJson(res.body); } // 校验人脸名字是否重复 - Future checkFaceNameDuplicatedData( - {required String lockId, required String faceName}) async { + Future checkFaceNameDuplicatedData({required String lockId, required String faceName}) async { final res = await apiProvider.checkFaceNameDuplicatedData(lockId, faceName); return LoginEntity.fromJson(res.body); } // 更新人脸用户序号 - Future updateFaceUserNo( - {required int faceId, - required int lockId, - required String faceUserNo}) async { + Future updateFaceUserNo({required int faceId, required int lockId, required String faceUserNo}) async { final res = await apiProvider.updateFaceUserNo(faceId, lockId, faceUserNo); return LoginEntity.fromJson(res.body); } // 更新人脸用户信息--人脸名称 - Future updateFaceName( - {required int faceId, - required int lockId, - required String faceName}) async { + Future updateFaceName({required int faceId, required int lockId, required String faceName}) async { final res = await apiProvider.updateFaceName(faceId, lockId, faceName); return LoginEntity.fromJson(res.body); } @@ -1547,19 +1343,8 @@ class ApiRepository { required String addType, required int isCoerced, required int faceRight}) async { - final res = await apiProvider.updateFaceValidity( - faceId, - lockId, - startDate, - endDate, - startTime, - endTime, - faceType, - weekDay, - faceName, - addType, - isCoerced, - faceRight); + final res = await apiProvider.updateFaceValidity(faceId, lockId, startDate, endDate, startTime, endTime, faceType, + weekDay, faceName, addType, isCoerced, faceRight); return LoginEntity.fromJson(res.body); } @@ -1593,8 +1378,7 @@ class ApiRepository { required String pageSize, required String searchStr, }) async { - final res = await apiProvider.getICCardListData( - lockId, pageNo, pageSize, searchStr); + final res = await apiProvider.getICCardListData(lockId, pageNo, pageSize, searchStr); return FingerprintListDataEntity.fromJson(res.body); } @@ -1613,19 +1397,8 @@ class ApiRepository { required int endTime, required int cardRight, }) async { - final res = await apiProvider.addICCardData( - lockId, - endDate, - cardName, - cardNumber, - cardType, - addType, - startDate, - isCoerced, - weekDay, - startTime, - endTime, - cardRight); + final res = await apiProvider.addICCardData(lockId, endDate, cardName, cardNumber, cardType, addType, startDate, + isCoerced, weekDay, startTime, endTime, cardRight); return AddICCardEntity.fromJson(res.body); } @@ -1644,46 +1417,27 @@ class ApiRepository { required int cardType, required int cardRight, }) async { - final res = await apiProvider.editICCardData( - lockId, - cardId, - cardName, - startDate, - endDate, - isCoerced, - weekDay, - changeType, - startTime, - endTime, - cardType, - cardRight); + final res = await apiProvider.editICCardData(lockId, cardId, cardName, startDate, endDate, isCoerced, weekDay, + changeType, startTime, endTime, cardType, cardRight); return LoginEntity.fromJson(res.body); } // 删除ic卡 Future deletIcCardData( - {required String cardId, - required String lockId, - required String type, - required String deleteType}) async { - final res = - await apiProvider.deletIcCardData(cardId, lockId, type, deleteType); + {required String cardId, required String lockId, required String type, required String deleteType}) async { + final res = await apiProvider.deletIcCardData(cardId, lockId, type, deleteType); return LoginEntity.fromJson(res.body); } // 更新ICCard用户序号 Future updateIdCardUserNoLoadData( - {required String lockId, - required String cardId, - required String cardUserNo}) async { - final res = await apiProvider.updateIdCardUserNoLoadData( - lockId, cardId, cardUserNo); + {required String lockId, required String cardId, required String cardUserNo}) async { + final res = await apiProvider.updateIdCardUserNoLoadData(lockId, cardId, cardUserNo); return LoginEntity.fromJson(res.body); } // 校验卡名字是否重复 - Future checkCardNameDuplicatedData( - {required String lockId, required String cardName}) async { + Future checkCardNameDuplicatedData({required String lockId, required String cardName}) async { final res = await apiProvider.checkCardNameDuplicatedData(lockId, cardName); return LoginEntity.fromJson(res.body); } @@ -1695,8 +1449,7 @@ class ApiRepository { required String pageSize, required String searchStr, }) async { - final res = await apiProvider.getRemoteControlListData( - lockId, pageNo, pageSize, searchStr); + final res = await apiProvider.getRemoteControlListData(lockId, pageNo, pageSize, searchStr); return FingerprintListDataEntity.fromJson(res.body); } @@ -1714,28 +1467,15 @@ class ApiRepository { required int endTime, required int remoteRight, }) async { - final res = await apiProvider.addRemoteControlData( - lockId, - remoteName, - remoteNumber, - remoteType, - startDate, - endDate, - addType, - weekDay, - startTime, - endTime, - remoteRight); + final res = await apiProvider.addRemoteControlData(lockId, remoteName, remoteNumber, remoteType, startDate, endDate, + addType, weekDay, startTime, endTime, remoteRight); return AddRemoteControlEntity.fromJson(res.body); } // 更新ICCard用户序号 Future updateRemoteUserNoLoadData( - {required int lockId, - required int remoteId, - required String remoteUserNo}) async { - final res = await apiProvider.updateRemoteUserNoLoadData( - lockId, remoteId, remoteUserNo); + {required int lockId, required int remoteId, required String remoteUserNo}) async { + final res = await apiProvider.updateRemoteUserNoLoadData(lockId, remoteId, remoteUserNo); return LoginEntity.fromJson(res.body); } @@ -1754,19 +1494,8 @@ class ApiRepository { required int isCoerced, required int remoteRight, }) async { - final res = await apiProvider.editRemoteControlData( - lockId, - remoteId, - startDate, - endDate, - startTime, - endTime, - remoteType, - weekDay, - remoteName, - addType, - isCoerced, - remoteRight); + final res = await apiProvider.editRemoteControlData(lockId, remoteId, startDate, endDate, startTime, endTime, + remoteType, weekDay, remoteName, addType, isCoerced, remoteRight); return LoginEntity.fromJson(res.body); } @@ -1783,10 +1512,8 @@ class ApiRepository { } // 校验遥控名字是否重复 - Future checkRemoteControlNameDuplicatedData( - {required String lockId, required String remoteName}) async { - final res = await apiProvider.checkRemoteControlNameDuplicatedData( - lockId, remoteName); + Future checkRemoteControlNameDuplicatedData({required String lockId, required String remoteName}) async { + final res = await apiProvider.checkRemoteControlNameDuplicatedData(lockId, remoteName); return LoginEntity.fromJson(res.body); } @@ -1797,8 +1524,7 @@ class ApiRepository { required String pageSize, required String searchStr, }) async { - final res = - await apiProvider.getPalmListData(lockId, pageNo, pageSize, searchStr); + final res = await apiProvider.getPalmListData(lockId, pageNo, pageSize, searchStr); return FingerprintListDataEntity.fromJson(res.body); } @@ -1816,28 +1542,15 @@ class ApiRepository { required int endTime, required int palmVeinRight, }) async { - final res = await apiProvider.addPalmData( - lockId, - palmVeinName, - palmVeinNumber, - palmVeinType, - startDate, - endDate, - addType, - weekDay, - startTime, - endTime, - palmVeinRight); + final res = await apiProvider.addPalmData(lockId, palmVeinName, palmVeinNumber, palmVeinType, startDate, endDate, + addType, weekDay, startTime, endTime, palmVeinRight); return AddPalmEntity.fromJson(res.body); } // 更新掌静脉用户序号 Future updatePalmUserNoLoadData( - {required int lockId, - required int palmVeinId, - required String palmVeinUserNo}) async { - final res = await apiProvider.updatePalmUserNoLoadData( - lockId, palmVeinId, palmVeinUserNo); + {required int lockId, required int palmVeinId, required String palmVeinUserNo}) async { + final res = await apiProvider.updatePalmUserNoLoadData(lockId, palmVeinId, palmVeinUserNo); return LoginEntity.fromJson(res.body); } @@ -1856,19 +1569,8 @@ class ApiRepository { required int isCoerced, required int palmVeinRight, }) async { - final res = await apiProvider.editPalmData( - lockId, - palmVeinId, - startDate, - endDate, - startTime, - endTime, - palmVeinType, - weekDay, - palmVeinName, - addType, - isCoerced, - palmVeinRight); + final res = await apiProvider.editPalmData(lockId, palmVeinId, startDate, endDate, startTime, endTime, palmVeinType, + weekDay, palmVeinName, addType, isCoerced, palmVeinRight); return LoginEntity.fromJson(res.body); } @@ -1885,10 +1587,8 @@ class ApiRepository { } // 校验掌静脉名字是否重复 - Future checkPalmNameDuplicatedData( - {required String lockId, required String palmVeinName}) async { - final res = - await apiProvider.checkPalmNameDuplicatedData(lockId, palmVeinName); + Future checkPalmNameDuplicatedData({required String lockId, required String palmVeinName}) async { + final res = await apiProvider.checkPalmNameDuplicatedData(lockId, palmVeinName); return LoginEntity.fromJson(res.body); } @@ -1899,44 +1599,34 @@ class ApiRepository { } // 获取转移锁锁列表 - Future getTransferLockListData( - {required String searchStr}) async { + Future getTransferLockListData({required String searchStr}) async { final res = await apiProvider.getTransferLockListData(searchStr); return TransferSmartLockEntity.fromJson(res.body); } // 转移智能锁确认 Future transferLockConfirmInfoData( - {required String receiverUsername, - required String type, - required String countryCode}) async { - final res = await apiProvider.transferLockConfirmInfoData( - receiverUsername, type, countryCode); + {required String receiverUsername, required String type, required String countryCode}) async { + final res = await apiProvider.transferLockConfirmInfoData(receiverUsername, type, countryCode); return RecipientInformationEntity.fromJson(res.body); } // 转移智能锁 Future transferLockInfoData( - {required String receiverUsername, - required List lockIdList, - required String countryCode}) async { - final res = await apiProvider.transferLockInfoData( - receiverUsername, lockIdList, countryCode); + {required String receiverUsername, required List lockIdList, required String countryCode}) async { + final res = await apiProvider.transferLockInfoData(receiverUsername, lockIdList, countryCode); return RecipientInformationEntity.fromJson(res.body); } // 获取网关列表 Future getGatewayListData( - {required String pageNo, - required String pageSize, - required int timeout}) async { + {required String pageNo, required String pageSize, required int timeout}) async { final res = await apiProvider.getGatewayListData(pageNo, pageSize, timeout); return GetewayDataEntity.fromJson(res.body); } // 获取网关详情 - Future getGatewayDetailData( - {required int gatewayId, required int timeout}) async { + Future getGatewayDetailData({required int gatewayId, required int timeout}) async { final res = await apiProvider.getGatewayDetailData(gatewayId, timeout); return GetewayInfoEntity.fromJson(res.body); } @@ -1953,103 +1643,75 @@ class ApiRepository { required Map gatewayJson, required int timeout}) async { final res = await apiProvider.addGatewayNetwork( - gatewayName, - gatewayMac, - serialNumber, - gatewayType, - networkName, - networkMac, - version, - gatewayJson, - timeout); + gatewayName, gatewayMac, serialNumber, gatewayType, networkName, networkMac, version, gatewayJson, timeout); return LoginEntity.fromJson(res.body); } // 删除网关 - Future gatewayDelet( - {required int gatewayId, - required int isForce, - required int timeout}) async { + Future gatewayDelet({required int gatewayId, required int isForce, required int timeout}) async { final res = await apiProvider.deletGateway(gatewayId, isForce, timeout); return LoginEntity.fromJson(res.body); } // 网关更新 - Future gatewayUpdate( - {required int gatewayId, - required String gatewayName, - required int timeout}) async { - final res = - await apiProvider.gatewayUpdate(gatewayId, gatewayName, timeout); + Future gatewayUpdate({required int gatewayId, required String gatewayName, required int timeout}) async { + final res = await apiProvider.gatewayUpdate(gatewayId, gatewayName, timeout); return LoginEntity.fromJson(res.body); } // 转移网关确认 Future transferGatewayConfirmInfoData( - {required String receiverUsername, - required String type, - required String countryCode}) async { - final res = await apiProvider.transferGatewayConfirmInfoData( - receiverUsername, type, countryCode); + {required String receiverUsername, required String type, required String countryCode}) async { + final res = await apiProvider.transferGatewayConfirmInfoData(receiverUsername, type, countryCode); return RecipientInformationEntity.fromJson(res.body); } // 网关-附近的锁 Future gatewayConnectionLockLoadData( {required int gatewayId, required int timeout}) async { - final res = - await apiProvider.gatewayConnectionLockListLoadData(gatewayId, timeout); + final res = await apiProvider.gatewayConnectionLockListLoadData(gatewayId, timeout); return GatewayConnectionLockListEntity.fromJson(res.body); } // 网关-扫描设备 - Future gatewayScanDevice( - {required int gatewayId, required int timeout}) async { + Future gatewayScanDevice({required int gatewayId, required int timeout}) async { final res = await apiProvider.gatewayScanDevice(gatewayId, timeout); return LoginEntity.fromJson(res.body); } // 远程开锁 - Future remoteOpenLock( - {required String lockId, required int timeOut}) async { + Future remoteOpenLock({required String lockId, required int timeOut}) async { final res = await apiProvider.remoteOpenLock(lockId, timeOut); return LoginEntity.fromJson(res.body); } // 转移智能锁 Future transferGatewayInfoData( - {required String receiverUsername, - required List plugIdList, - required String countryCode}) async { - final res = await apiProvider.transferGatewayInfoData( - receiverUsername, plugIdList, countryCode); + {required String receiverUsername, required List plugIdList, required String countryCode}) async { + final res = await apiProvider.transferGatewayInfoData(receiverUsername, plugIdList, countryCode); return RecipientInformationEntity.fromJson(res.body); } // 获取网关配置 - Future getGatewayConfiguration( - {required int timeout}) async { + Future getGatewayConfiguration({required int timeout}) async { final res = await apiProvider.getGatewayConfiguration(timeout); return GetGatewayConfigurationEntity.fromJson(res.body); } // 获取网关配置 - Future getGatewayConfigurationNotLoading( - {required int timeout}) async { + Future getGatewayConfigurationNotLoading({required int timeout}) async { final res = await apiProvider.getGatewayConfigurationNotLoading(timeout); return GetGatewayConfigurationEntity.fromJson(res.body); } // 移除坏锁 - Future removeBrokenLockData( - {required List lockIdList}) async { + Future removeBrokenLockData({required List lockIdList}) async { final res = await apiProvider.removeBrokenLockData(lockIdList); return RecipientInformationEntity.fromJson(res.body); } //删除账号 - Future deleteAccount( - String channel, String verificationCode) async { + Future deleteAccount(String channel, String verificationCode) async { final res = await apiProvider.deleteAccount(channel, verificationCode); return LoginEntity.fromJson(res.body); } @@ -2061,8 +1723,7 @@ class ApiRepository { } //重置密码钥匙 - Future keyboardPwdReset( - {required String lockId, required List passwordKey}) async { + Future keyboardPwdReset({required String lockId, required List passwordKey}) async { final res = await apiProvider.keyboardPwdReset(lockId, passwordKey); return PasswordKeyListEntity.fromJson(res.body); } @@ -2074,8 +1735,7 @@ class ApiRepository { required String channel, required String codeType, required String xWidth}) async { - final res = await apiProvider.sendValidationCodeAuth( - countryCode, account, channel, codeType, xWidth); + final res = await apiProvider.sendValidationCodeAuth(countryCode, account, channel, codeType, xWidth); return SendValidationCodeEntity.fromJson(res.body); } @@ -2088,8 +1748,7 @@ class ApiRepository { } //更新个人信息-头像 - Future updateUserHeadUrlInfo( - {required String headUrl}) async { + Future updateUserHeadUrlInfo({required String headUrl}) async { final res = await apiProvider.updateUserHeadUrlInfo(headUrl); return PasswordKeyListEntity.fromJson(res.body); } @@ -2111,39 +1770,32 @@ class ApiRepository { } //更新个人信息-国际化 - Future updateUserLangInfo( - {required String lang}) async { + Future updateUserLangInfo({required String lang}) async { final res = await apiProvider.updateUserLangInfo(lang); return PasswordKeyListEntity.fromJson(res.body); } //修改绑定手机号 - Future bindPhone(String countryCode, String account, - String verificationCode, String unbindToken) async { - final res = await apiProvider.bindPhone( - countryCode, account, verificationCode, unbindToken); + Future bindPhone( + String countryCode, String account, String verificationCode, String unbindToken) async { + final res = await apiProvider.bindPhone(countryCode, account, verificationCode, unbindToken); return PasswordKeyListEntity.fromJson(res.body); } //修改绑定邮箱 - Future bindEmail( - String email, String verificationCode, String unbindToken) async { - final res = - await apiProvider.bindEmail(email, verificationCode, unbindToken); + Future bindEmail(String email, String verificationCode, String unbindToken) async { + final res = await apiProvider.bindEmail(email, verificationCode, unbindToken); return PasswordKeyListEntity.fromJson(res.body); } //重置密码 - Future changePassword( - String date, String newPassword, String oldPassword) async { - final res = - await apiProvider.changePassword(date, newPassword, oldPassword); + Future changePassword(String date, String newPassword, String oldPassword) async { + final res = await apiProvider.changePassword(date, newPassword, oldPassword); return LoginEntity.fromJson(res.body); } //获取安全信息列表 - Future getQuestionList( - String operatorUid, String countryCode) async { + Future getQuestionList(String operatorUid, String countryCode) async { final res = await apiProvider.getQuestionList(operatorUid, countryCode); return MineSetSafetyProblemEntity.fromJson(res.body); } @@ -2186,22 +1838,19 @@ class ApiRepository { } //获取解绑手机号Token - Future unbindPhoneToken( - String verificationCode) async { + Future unbindPhoneToken(String verificationCode) async { final res = await apiProvider.unbindPhoneToken(verificationCode); return MineUnbindPhoneOrEmailEntity.fromJson(res.body); } //获取解绑邮箱Token - Future unbindEmailToken( - String verificationCode) async { + Future unbindEmailToken(String verificationCode) async { final res = await apiProvider.unbindEmailToken(verificationCode); return MineUnbindPhoneOrEmailEntity.fromJson(res.body); } //推送绑定DeviceID - Future pushBindAppId( - String deviceId, int deviceType) async { + Future pushBindAppId(String deviceId, int deviceType) async { final res = await apiProvider.pushBindAppId(deviceId, deviceType); return MineUnbindPhoneOrEmailEntity.fromJson(res.body); } @@ -2214,8 +1863,7 @@ class ApiRepository { } // 消息列表 - Future messageListLoadData( - {required String pageNo, required String pageSize}) async { + Future messageListLoadData({required String pageNo, required String pageSize}) async { final res = await apiProvider.messageListLoadData(pageNo, pageSize); return MessageListEntity.fromJson(res.body); } @@ -2243,84 +1891,68 @@ class ApiRepository { } // 获取版本号 - Future getVersionData( - {required String brandName, required String currentVersion}) async { + Future getVersionData({required String brandName, required String currentVersion}) async { final res = await apiProvider.getVersionData(brandName, currentVersion); return VersionUndateEntity.fromJson(res.body); } // 设置猫眼工作模式 - Future updateCatEyeModeConfig( - {required int lockId, required List catEyeConfig}) async { + Future updateCatEyeModeConfig({required int lockId, required List catEyeConfig}) async { final res = await apiProvider.updateCatEyeModeConfig(lockId, catEyeConfig); return VersionUndateEntity.fromJson(res.body); } // 设置自动亮屏 - Future updateAutoLightScreenConfig( - {required int lockId, required int autoLightScreen}) async { - final res = - await apiProvider.updateAutoLightScreenConfig(lockId, autoLightScreen); + Future updateAutoLightScreenConfig({required int lockId, required int autoLightScreen}) async { + final res = await apiProvider.updateAutoLightScreenConfig(lockId, autoLightScreen); return VersionUndateEntity.fromJson(res.body); } // 设置亮屏持续时间 Future updateLightScreenTimeConfig( {required int lockId, required int autoLightScreenTime}) async { - final res = await apiProvider.updateLightScreenTimeConfig( - lockId, autoLightScreenTime); + final res = await apiProvider.updateLightScreenTimeConfig(lockId, autoLightScreenTime); return VersionUndateEntity.fromJson(res.body); } // 设置逗留警告 - Future updateStayWarnConfig( - {required int lockId, required int stayWarn}) async { + Future updateStayWarnConfig({required int lockId, required int stayWarn}) async { final res = await apiProvider.updateStayWarnConfig(lockId, stayWarn); return VersionUndateEntity.fromJson(res.body); } // 设置异常警告 - Future updateAbnormalWarnConfig( - {required int lockId, required int abnormalWarn}) async { - final res = - await apiProvider.updateAbnormalWarnConfig(lockId, abnormalWarn); + Future updateAbnormalWarnConfig({required int lockId, required int abnormalWarn}) async { + final res = await apiProvider.updateAbnormalWarnConfig(lockId, abnormalWarn); return VersionUndateEntity.fromJson(res.body); } // 设置面容开锁 - Future updateFaceSwitch( - {required int lockId, required int faceSwitch}) async { + Future updateFaceSwitch({required int lockId, required int faceSwitch}) async { final res = await apiProvider.updateFaceSwitch(lockId, faceSwitch); return VersionUndateEntity.fromJson(res.body); } // 设置面容感应距离 - Future updateFaceSenseDistance( - {required int lockId, required int faceInductionDistance}) async { - final res = await apiProvider.updateFaceSenseDistance( - lockId, faceInductionDistance); + Future updateFaceSenseDistance({required int lockId, required int faceInductionDistance}) async { + final res = await apiProvider.updateFaceSenseDistance(lockId, faceInductionDistance); return VersionUndateEntity.fromJson(res.body); } // 设置面容防误开 - Future updateFacePreventMisrun( - {required int lockId, required int faceEnErrUnlock}) async { - final res = - await apiProvider.updateFacePreventMisrun(lockId, faceEnErrUnlock); + Future updateFacePreventMisrun({required int lockId, required int faceEnErrUnlock}) async { + final res = await apiProvider.updateFacePreventMisrun(lockId, faceEnErrUnlock); return VersionUndateEntity.fromJson(res.body); } // 设置面容自动亮屏 - Future updateFaceAutoLightScreen( - {required int lockId, required int faceAutoLightScreen}) async { - final res = await apiProvider.updateFaceAutoLightScreen( - lockId, faceAutoLightScreen); + Future updateFaceAutoLightScreen({required int lockId, required int faceAutoLightScreen}) async { + final res = await apiProvider.updateFaceAutoLightScreen(lockId, faceAutoLightScreen); return VersionUndateEntity.fromJson(res.body); } // 获取锁消息设置 - Future getLockNoticeSetting( - {required int lockId}) async { + Future getLockNoticeSetting({required int lockId}) async { final res = await apiProvider.getLockNoticeSetting(lockId); return MsgNotificationEntity.fromJson(res.body); } @@ -2331,18 +1963,15 @@ class ApiRepository { required int dayNotOpenDoorState, required int dayNotOpenDoorValue, required List dayNotOpenDoorNoticeWayList}) async { - final res = await apiProvider.updateNdaysNotCloseDoorNoticeSetting(lockId, - dayNotOpenDoorState, dayNotOpenDoorValue, dayNotOpenDoorNoticeWayList); + final res = await apiProvider.updateNdaysNotCloseDoorNoticeSetting( + lockId, dayNotOpenDoorState, dayNotOpenDoorValue, dayNotOpenDoorNoticeWayList); return OpenDoorNotifyEntity.fromJson(res.body); } // 设置低电量提醒 Future updatelowElecNoticeStateSetting( - {required int lockId, - required int lowElecNoticeState, - required List lowElecNoticeWayList}) async { - final res = await apiProvider.updatelowElecNoticeStateSetting( - lockId, lowElecNoticeState, lowElecNoticeWayList); + {required int lockId, required int lowElecNoticeState, required List lowElecNoticeWayList}) async { + final res = await apiProvider.updatelowElecNoticeStateSetting(lockId, lowElecNoticeState, lowElecNoticeWayList); return OpenDoorNotifyEntity.fromJson(res.body); } @@ -2351,8 +1980,7 @@ class ApiRepository { required int lockId, required int doorNotCloseState, }) async { - final res = - await apiProvider.updateDoorNotCloseSetting(lockId, doorNotCloseState); + final res = await apiProvider.updateDoorNotCloseSetting(lockId, doorNotCloseState); return MsgNotificationEntity.fromJson(res.body); } @@ -2361,8 +1989,7 @@ class ApiRepository { required int lockId, required int doorbellNoticeState, }) async { - final res = await apiProvider.updateDoorbellNoticeStateSetting( - lockId, doorbellNoticeState); + final res = await apiProvider.updateDoorbellNoticeStateSetting(lockId, doorbellNoticeState); return MsgNotificationEntity.fromJson(res.body); } @@ -2371,8 +1998,7 @@ class ApiRepository { required int lockId, required int someoneAtDoorNoticeState, }) async { - final res = await apiProvider.updateSomeoneAtDoorNoticeStateSetting( - lockId, someoneAtDoorNoticeState); + final res = await apiProvider.updateSomeoneAtDoorNoticeStateSetting(lockId, someoneAtDoorNoticeState); return MsgNotificationEntity.fromJson(res.body); } @@ -2381,61 +2007,46 @@ class ApiRepository { required int lockId, required int tamperAlarmState, }) async { - final res = await apiProvider.updaTetamperAlarmStateSetting( - lockId, tamperAlarmState); + final res = await apiProvider.updaTetamperAlarmStateSetting(lockId, tamperAlarmState); return MsgNotificationEntity.fromJson(res.body); } // 锁用户列表 - Future getLockKeysList( - {required int lockId, required String searchStr}) async { + Future getLockKeysList({required int lockId, required String searchStr}) async { final res = await apiProvider.getLockKeysList(lockId, searchStr); return LockUserEntity.fromJson(res.body); } // 添加开门通知 Future addLockNoticeSetting( - {required int lockId, - required int noticeType, - required Map settingValue}) async { - final res = await apiProvider.addLockNoticeSetting( - lockId, noticeType, settingValue); + {required int lockId, required int noticeType, required Map settingValue}) async { + final res = await apiProvider.addLockNoticeSetting(lockId, noticeType, settingValue); return MsgNotificationEntity.fromJson(res.body); } // 开门通知列表 - Future lockNoticeSettingAccountList( - {required int lockId, required int noticeType}) async { - final res = - await apiProvider.lockNoticeSettingAccountList(lockId, noticeType); + Future lockNoticeSettingAccountList({required int lockId, required int noticeType}) async { + final res = await apiProvider.lockNoticeSettingAccountList(lockId, noticeType); return OpenDoorNotifyEntity.fromJson(res.body); } // 删除开门通知 - Future deleteLockNoticeSettingAccount( - {required int lockNoticeSettingAccountId}) async { - final res = await apiProvider - .deleteLockNoticeSettingAccount(lockNoticeSettingAccountId); + Future deleteLockNoticeSettingAccount({required int lockNoticeSettingAccountId}) async { + final res = await apiProvider.deleteLockNoticeSettingAccount(lockNoticeSettingAccountId); return OpenDoorNotifyEntity.fromJson(res.body); } // 更新开门通知 Future updateLockNoticeSettingAccount( - {required int lockNoticeSettingAccountId, - required Map settingValue}) async { - final res = await apiProvider.updateLockNoticeSettingAccount( - lockNoticeSettingAccountId, settingValue); + {required int lockNoticeSettingAccountId, required Map settingValue}) async { + final res = await apiProvider.updateLockNoticeSettingAccount(lockNoticeSettingAccountId, settingValue); return OpenDoorNotifyEntity.fromJson(res.body); } // 获取胁迫指纹列表 Future getCoercedFingerprintList( - {required int lockId, - required int pageNo, - required int pageSize, - required String searchStr}) async { - final res = await apiProvider.getCoercedFingerprintList( - lockId, pageNo, pageSize, searchStr); + {required int lockId, required int pageNo, required int pageSize, required String searchStr}) async { + final res = await apiProvider.getCoercedFingerprintList(lockId, pageNo, pageSize, searchStr); return CoerceFingerprintListEntity.fromJson(res.body); } @@ -2470,15 +2081,13 @@ class ApiRepository { } // 删除云存列表 - Future deleteLockCloudStorageList( - {required List recordIds}) async { + Future deleteLockCloudStorageList({required List recordIds}) async { final res = await apiProvider.deleteLockCloudStorageList(recordIds); return VersionUndateEntity.fromJson(res.body); } // 设置微信公众号推送 - Future setMpWechatPushSwitch( - {required int mpWechatPushSwitch}) async { + Future setMpWechatPushSwitch({required int mpWechatPushSwitch}) async { final res = await apiProvider.setMpWechatPushSwitch(mpWechatPushSwitch); return VersionUndateEntity.fromJson(res.body); } @@ -2490,8 +2099,7 @@ class ApiRepository { } // 设置实名认证频次 - Future setFaceAuthentication( - {required int faceAuthFrequence}) async { + Future setFaceAuthentication({required int faceAuthFrequence}) async { final res = await apiProvider.setFaceAuthentication(faceAuthFrequence); return FaceAuthenticationEntity.fromJson(res.body); } @@ -2503,8 +2111,7 @@ class ApiRepository { required int recordType, int pageSize = 10, }) async { - final res = - await apiProvider.getBuyRecordList(type, recordType, pageNo, pageSize); + final res = await apiProvider.getBuyRecordList(type, recordType, pageNo, pageSize); return UseRecordListEntity.fromJson(res.body); } @@ -2572,9 +2179,10 @@ class ApiRepository { required int recordType, required List records, required bool isUnShowLoading, + bool isShowNetworkErrorMsg = false, }) async { final res = await apiProvider.lockDataUpload( - lockId, uploadType, recordType, records, isUnShowLoading); + lockId, uploadType, recordType, records, isUnShowLoading, isShowNetworkErrorMsg); return LoginEntity.fromJson(res.body); } @@ -2584,8 +2192,7 @@ class ApiRepository { required int keyId, required int channelType, }) async { - final Response res = - await apiProvider.getNoticeTemplate(lockId, keyId, channelType); + final Response res = await apiProvider.getNoticeTemplate(lockId, keyId, channelType); return NoticeTemplateEntity.fromJson(res.body); } @@ -2596,10 +2203,8 @@ class ApiRepository { } // 获取最新固件 - Future getFwVersion( - {required String model, required String currentVersion}) async { - final Response res = - await apiProvider.getFwVersion(model, currentVersion); + Future getFwVersion({required String model, required String currentVersion}) async { + final Response res = await apiProvider.getFwVersion(model, currentVersion); return FwVersionEntity.fromJson(res.body); } @@ -2611,11 +2216,8 @@ class ApiRepository { // 获取短信模板列表 Future getSMSTemplateList( - {required int channelType, - required int pageNo, - required int pageSize}) async { - final Response res = - await apiProvider.getSMSTemplateList(channelType, pageNo, pageSize); + {required int channelType, required int pageNo, required int pageSize}) async { + final Response res = await apiProvider.getSMSTemplateList(channelType, pageNo, pageSize); return CustomSMSTemplateListEntity.fromJson(res.body); } @@ -2627,19 +2229,15 @@ class ApiRepository { required String regards, required String tips, required int templateType}) async { - final Response res = await apiProvider.addTemplateService( - channelType, name, langType, regards, tips, templateType); + final Response res = + await apiProvider.addTemplateService(channelType, name, langType, regards, tips, templateType); return LoginEntity.fromJson(res.body); } // 更新模板信息 Future updateTemplateInfo( - {required int id, - required String name, - required String regards, - required String tips}) async { - final Response res = - await apiProvider.updateTemplateInfo(id, name, regards, tips); + {required int id, required String name, required String regards, required String tips}) async { + final Response res = await apiProvider.updateTemplateInfo(id, name, regards, tips); return LoginEntity.fromJson(res.body); } @@ -2661,8 +2259,7 @@ class ApiRepository { required int keyId, required int channelType, }) async { - final Response res = - await apiProvider.getKeyNoticeTemplate(lockId, keyId, channelType); + final Response res = await apiProvider.getKeyNoticeTemplate(lockId, keyId, channelType); return SendEmailNotificationEntity.fromJson(res.body); } @@ -2672,8 +2269,7 @@ class ApiRepository { required int keyboardPwdId, required int channelType, }) async { - final Response res = await apiProvider.getPwdNoticeTemplate( - lockId, keyboardPwdId, channelType); + final Response res = await apiProvider.getPwdNoticeTemplate(lockId, keyboardPwdId, channelType); return SendEmailNotificationEntity.fromJson(res.body); } @@ -2687,13 +2283,7 @@ class ApiRepository { required String templateType, required int countryCode}) async { final Response res = await apiProvider.keyNoticeSubmit( - receiverName, - lockId, - keyId, - channelType, - openDoorType, - templateType, - countryCode); + receiverName, lockId, keyId, channelType, openDoorType, templateType, countryCode); return SendEmailNotificationEntity.fromJson(res.body); } @@ -2707,13 +2297,7 @@ class ApiRepository { required String templateType, required int countryCode}) async { final Response res = await apiProvider.pwdNoticeSubmit( - receiverName, - lockId, - keyboardPwdId, - channelType, - openDoorType, - templateType, - countryCode); + receiverName, lockId, keyboardPwdId, channelType, openDoorType, templateType, countryCode); return SendEmailNotificationEntity.fromJson(res.body); } @@ -2722,8 +2306,7 @@ class ApiRepository { required int lockId, required String fwVersion, }) async { - final Response res = - await apiProvider.getLockUpdateLockInfo(lockId, fwVersion); + final Response res = await apiProvider.getLockUpdateLockInfo(lockId, fwVersion); return UpdateLockInfoEntity.fromJson(res.body); } @@ -2733,8 +2316,7 @@ class ApiRepository { required int startDate, required int endDate, }) async { - final Response res = - await apiProvider.exportLockRecords(lockId, startDate, endDate); + final Response res = await apiProvider.exportLockRecords(lockId, startDate, endDate); return ExportRecordEntity.fromJson(res.body); } @@ -2744,8 +2326,7 @@ class ApiRepository { required int startDate, required int endDate, }) async { - final Response res = - await apiProvider.batchExportLockRecords(lockIds, startDate, endDate); + final Response res = await apiProvider.batchExportLockRecords(lockIds, startDate, endDate); return ExportRecordEntity.fromJson(res.body); } @@ -2767,8 +2348,8 @@ class ApiRepository { required String starchartPeerPublicKey, required String starchartPeerPrivateKey, }) async { - final Response res = await apiProvider.bindUserStarchart( - starchartId, starchartPeerPublicKey, starchartPeerPrivateKey); + final Response res = + await apiProvider.bindUserStarchart(starchartId, starchartPeerPublicKey, starchartPeerPrivateKey); return LoginEntity.fromJson(res.body); } @@ -2782,8 +2363,7 @@ class ApiRepository { required String secretKey, required String peerId, }) async { - final res = await apiProvider.settingDeviceNetwork( - deviceType, deviceMac, wifiName, networkMac, secretKey, peerId); + final res = await apiProvider.settingDeviceNetwork(deviceType, deviceMac, wifiName, networkMac, secretKey, peerId); return LoginEntity.fromJson(res.body); }