From 19b2352ea989244f902a55df88ffe2a244f8a115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Tue, 14 May 2024 15:11:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=A1=E6=8C=87=E7=BA=B9?= =?UTF-8?q?=E4=BA=BA=E8=84=B8=E7=94=B5=E5=AD=90=E9=92=A5=E5=8C=99=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=E5=BD=93=E5=A4=A9=E7=BB=93=E6=9D=9F=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E6=99=9A=E4=B8=8A12=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io_protocol/io_senderCustomPasswords.dart | 2 +- .../lib/blue/sender_beforeDataManage.dart | 31 ++++++++++--------- star_lock/lib/blue/sender_data.dart | 1 + .../card/addICCard/addICCard_state.dart | 4 ++- .../otherTypeKeyChangeValidityDate_page.dart | 8 ++--- .../face/addFace/addFace_state.dart | 4 ++- .../face/addFaceType/addFaceType_page.dart | 2 +- .../addFingerprint/addFingerprint_state.dart | 3 +- .../fingerprintDetail_page.dart | 7 ++--- .../passwordKeyDetail_logic.dart | 6 ++-- .../passwordKey_perpetual_page.dart | 9 ++++-- star_lock/lib/tools/commonDataManage.dart | 2 ++ .../seletKeyCyclicDate_page.dart | 3 +- star_lock/pubspec.yaml | 3 +- 14 files changed, 48 insertions(+), 37 deletions(-) diff --git a/star_lock/lib/blue/io_protocol/io_senderCustomPasswords.dart b/star_lock/lib/blue/io_protocol/io_senderCustomPasswords.dart index 43b544e5..1fbf7d06 100644 --- a/star_lock/lib/blue/io_protocol/io_senderCustomPasswords.dart +++ b/star_lock/lib/blue/io_protocol/io_senderCustomPasswords.dart @@ -49,7 +49,7 @@ class SenderCustomPasswordsCommand extends SenderProtocol { @override String toString() { return 'SenderCustomPasswordsCommand{keyID: $keyID, userID: $userID, ' - 'pwdNo: $pwdNo, pwd: $pwd, useCountLimit: $useCountLimit, ' + 'pwdNo: $pwdNo, pwd: $pwd, useCountLimit: $useCountLimit, operate: $operate, isAdmin: $isAdmin,' 'token: $token, ' 'startTime: ${DateTool().dateIntToYMDHNString(startTime)}, ' 'endTime: ${DateTool().dateIntToYMDHNString(endTime)}, ' diff --git a/star_lock/lib/blue/sender_beforeDataManage.dart b/star_lock/lib/blue/sender_beforeDataManage.dart index a3239d22..b1ca8d5f 100644 --- a/star_lock/lib/blue/sender_beforeDataManage.dart +++ b/star_lock/lib/blue/sender_beforeDataManage.dart @@ -1,16 +1,12 @@ import 'dart:async'; -import 'package:flutter_blue_plus/flutter_blue_plus.dart'; -import 'package:get/get.dart'; import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart'; -import 'package:star_lock/blue/sender_manage.dart'; +import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart'; -import 'package:star_lock/network/api_provider.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/eventBusEventManage.dart'; -import '../app_settings/app_settings.dart'; import '../main/lockDetail/lockDetail/lockNetToken_entity.dart'; import '../network/api_repository.dart'; import '../tools/commonDataManage.dart'; @@ -43,12 +39,12 @@ class SenderBeforeDataManage { // 监听设备返回的数据 StreamSubscription? _replySubscription; - + bool isBeforeAddUser = true; // 启动订阅 void _initReplySubscription() { _replySubscription ??= EventBusManager().eventBus!.on().listen((reply) async { // 添加用户 - if (reply is AddUserReply) { + if (reply is AddUserReply && isBeforeAddUser == false) { _replyAddUserKey(reply); } @@ -160,21 +156,26 @@ class SenderBeforeDataManage { } LockListInfoItemEntity currentKeyInfo = CommonDataManage().currentKeyInfo; - DateTime startTime = - DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.startDate! ~/ 1000); - DateTime endTime = - DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.endDate! ~/ 1000); - bool isRound = currentKeyInfo.keyType == 2; + DateTime startTime = DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.startDate! ~/ 1000); + DateTime endTime = DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.endDate! ~/ 1000); + bool isRound = currentKeyInfo.keyType == XSConstantMacro.keyTypeLoop; + var startDateTime = currentKeyInfo.startDate! ~/ 1000; + var endDateTime = currentKeyInfo.endDate! ~/ 1000; + if (isRound) { + // 循环钥匙 + startDateTime = DateTool().dateToTimestamp(DateTool().dateToYMDString(currentKeyInfo.startDate!.toString()), 1) ~/ 1000; + endDateTime = (DateTool().dateToTimestamp(DateTool().dateToYMDString(currentKeyInfo.endDate!.toString()), 1) + CommonDataManage().dayLatestTime) ~/ 1000; + } var addUserData = AddUserCommand( lockID: BlueManage().connectDeviceName, authUserID: currentKeyInfo.senderUserId!.toString(), keyID: currentKeyInfo.keyId.toString(), userID: await Storage.getUid(), openMode: 1, - keyType: currentKeyInfo.keyType, - startDate: currentKeyInfo.startDate! ~/ 1000, - expireDate: currentKeyInfo.endDate! ~/ 1000, + keyType: 0, + startDate: startDateTime, + expireDate: endDateTime, useCountLimit: 0xFFFF, isRound: isRound ? 1 : 0, weekRound: isRound diff --git a/star_lock/lib/blue/sender_data.dart b/star_lock/lib/blue/sender_data.dart index 4abc61e0..b8485900 100644 --- a/star_lock/lib/blue/sender_data.dart +++ b/star_lock/lib/blue/sender_data.dart @@ -55,6 +55,7 @@ class CommandSenderManager { return; } + SenderBeforeDataManage().isBeforeAddUser = isBeforeAddUser; List value = command.packageData(); if (isBeforeAddUser == true) { // 如果是添加用户之前调用协议 直接发送 diff --git a/star_lock/lib/main/lockDetail/card/addICCard/addICCard_state.dart b/star_lock/lib/main/lockDetail/card/addICCard/addICCard_state.dart index 2898303d..fd7f9a67 100644 --- a/star_lock/lib/main/lockDetail/card/addICCard/addICCard_state.dart +++ b/star_lock/lib/main/lockDetail/card/addICCard/addICCard_state.dart @@ -1,6 +1,8 @@ import 'package:get/get.dart'; +import '../../../../tools/commonDataManage.dart'; + class AddICCardState{ var ifConnectScuess = false.obs; var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 @@ -25,7 +27,7 @@ class AddICCardState{ AddICCardState() { Map map = Get.arguments; lockId.value = map["lockId"]; - endDate.value = map["endDate"]; + endDate.value = "${int.parse(map["endDate"]) + CommonDataManage().dayLatestTime}"; addType.value = map["addType"]; cardName.value = map["cardName"]; cardNumber.value = map["cardNumber"]; diff --git a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_page.dart b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_page.dart index 13217817..13d1e249 100644 --- a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_page.dart +++ b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeValidityDate/otherTypeKeyChangeValidityDate_page.dart @@ -6,6 +6,7 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart'; import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart'; import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/commonDataManage.dart'; import '../../../../tools/commonItem.dart'; import '../../../../tools/dateTool.dart'; import '../../../../tools/submitBtn.dart'; @@ -49,13 +50,13 @@ class _OtherTypeKeyChangeValidityDatePageState state.starDateTimestamp.value = DateTool().dateToTimestamp(state.starDate.value, 1); state.endDateTimestamp.value = - DateTool().dateToTimestamp(state.endDate.value, 1); + DateTool().dateToTimestamp(state.endDate.value, 1) + CommonDataManage().dayLatestTime; state.starTimeTimestamp.value = DateTool().dateToTimestamp(state.starTime.value, 0); state.endTimeTimestamp.value = DateTool().dateToTimestamp(state.endTime.value, 0); - if (state.starDateTimestamp.value >= + if (state.starDateTimestamp.value > state.endDateTimestamp.value) { logic.showToast("失效日期要大于生效日期".tr); return; @@ -111,8 +112,7 @@ class _OtherTypeKeyChangeValidityDatePageState Pickers.showDatePicker(context, selectDate: selectDate, mode: DateMode.YMD, onConfirm: (p) { - state.starDate.value = - DateTool().getYMDHNDateString(p, 2); + state.starDate.value = DateTool().getYMDHNDateString(p, 2); }); })), Obx(() => CommonItem( diff --git a/star_lock/lib/main/lockDetail/face/addFace/addFace_state.dart b/star_lock/lib/main/lockDetail/face/addFace/addFace_state.dart index ff19b918..7cd2938a 100644 --- a/star_lock/lib/main/lockDetail/face/addFace/addFace_state.dart +++ b/star_lock/lib/main/lockDetail/face/addFace/addFace_state.dart @@ -1,5 +1,7 @@ import 'package:get/get.dart'; +import '../../../../tools/commonDataManage.dart'; + class AddFaceState { var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 var ifAddState = false.obs;// 是否是添加状态,如果是添加状态,返回上级界面发送取消添加指令 @@ -31,7 +33,7 @@ class AddFaceState { AddFaceState() { Map map = Get.arguments; lockId.value = map["lockId"]; - endDate.value = map["endDate"]; + endDate.value = "${int.parse(map["endDate"]) + CommonDataManage().dayLatestTime}"; addType.value = map["addType"]; faceName.value = map["faceName"]; faceType.value = map["faceType"]; diff --git a/star_lock/lib/main/lockDetail/face/addFaceType/addFaceType_page.dart b/star_lock/lib/main/lockDetail/face/addFaceType/addFaceType_page.dart index 002df0f0..70daec89 100644 --- a/star_lock/lib/main/lockDetail/face/addFaceType/addFaceType_page.dart +++ b/star_lock/lib/main/lockDetail/face/addFaceType/addFaceType_page.dart @@ -270,7 +270,7 @@ class _AddFaceTypePageState extends State isTipsImg: false, isHaveRightWidget: true, rightWidget: SizedBox( - width: 60.w, height: 50.h, child: Obx(() => _isAdmin()))))), + width: 60.w, height: 50.h, child: _isAdmin())))), SizedBox(height: 30.h), SubmitBtn( btnName: TranslationLoader.lanKeys!.next!.tr, diff --git a/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_state.dart b/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_state.dart index a6b5e492..55fe1bf0 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_state.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/addFingerprint/addFingerprint_state.dart @@ -1,5 +1,6 @@ import 'package:get/get.dart'; +import 'package:star_lock/tools/commonDataManage.dart'; class AddFingerprintState{ var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 @@ -28,7 +29,7 @@ class AddFingerprintState{ AddFingerprintState() { Map map = Get.arguments; lockId.value = map["lockId"]; - endDate.value = map["endDate"]; + endDate.value = "${int.parse(map["endDate"]) + CommonDataManage().dayLatestTime}"; addType.value = map["addType"]; fingerprintName.value = map["fingerprintName"]; fingerprintType.value = map["fingerprintType"]; diff --git a/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart b/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart index 1c5718ff..23e9397e 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart @@ -111,7 +111,7 @@ class _FingerprintDetailPageState extends State state.endDate.value = data["endDate"]; state.startDate.value = data["starTime"]; state.endTime.value = data["endTime"]; - state.weekDay.value = data["weekDay"]; + state.weekDay.value = data["validityValue"]; }); } } @@ -137,7 +137,7 @@ class _FingerprintDetailPageState extends State state.endDate.value = data["endDate"]; state.startDate.value = data["starTime"]; state.endTime.value = data["endTime"]; - state.weekDay.value = data["weekDay"]; + state.weekDay.value = data["validityValue"]; }); } })))), @@ -153,8 +153,7 @@ class _FingerprintDetailPageState extends State Routers.otherTypeKeyChangeValidityDatePage, arguments: { "pushType": 1, - "fingerprintItemData": - state.fingerprintItemData.value, + "fingerprintItemData": state.fingerprintItemData.value, }); if (data != null) { setState(() { diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart index 88031689..bcd11bc7 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart @@ -24,7 +24,7 @@ class PasswordKeyDetailLogic extends BaseGetXController { void _initReplySubscription() { _replySubscription = EventBusManager().eventBus!.on().listen((reply) async { // 设置自定义密码 - if ((reply is SenderCustomPasswordsReply) && (state.ifCurrentScreen.value == true)) { + if (reply is SenderCustomPasswordsReply) { int status = reply.data[2]; switch (status) { case 0x00: @@ -54,7 +54,7 @@ class PasswordKeyDetailLogic extends BaseGetXController { keyID:state.itemData.value.keyboardPwdId!.toString(), userID:await Storage.getUid(), pwdNo: state.itemData.value.pwdUserNo!, - pwd: state.isDeletPasswordKey.value == true ? "0" : state.inputPwdController.text, + pwd: state.inputPwdController.text, useCountLimit: 0xffff, operate: state.isDeletPasswordKey.value == true ? 2 : 1, isAdmin: state.isAdministrator.value == true ? 1 : 0, @@ -156,7 +156,7 @@ class PasswordKeyDetailLogic extends BaseGetXController { keyID:state.itemData.value.keyboardPwdId!.toString(), userID:await Storage.getUid(), pwdNo: state.itemData.value.pwdUserNo!, - pwd: state.itemData.value.isCustom == 1 ? state.inputPwdController.text :state.isDeletPasswordKey.value == true ? "0" : state.inputPwdController.text, + pwd: state.inputPwdController.text, useCountLimit: 0xffff, operate: state.itemData.value.isCustom == 1 ? state.isDeletPasswordKey.value == true ? 2 : 1 : 3, isAdmin: state.isAdministrator.value == true ? 1 : 0, diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart index 8760d93c..af7888ab 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart @@ -571,10 +571,13 @@ class _PasswordKeyPerpetualPageState extends State child: TextField( //输入框一行 maxLines: 1, - inputFormatters: [ + inputFormatters: editController == state.pwdController ? [ FilteringTextInputFormatter.deny('\n'), - LengthLimitingTextInputFormatter( - editController == state.nameController ? 50 : 9), + LengthLimitingTextInputFormatter(9), + FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), + ]:[ + FilteringTextInputFormatter.deny('\n'), + LengthLimitingTextInputFormatter(50), ], keyboardType: editController == state.nameController ? TextInputType.text diff --git a/star_lock/lib/tools/commonDataManage.dart b/star_lock/lib/tools/commonDataManage.dart index 1d7d12b6..f76f066e 100644 --- a/star_lock/lib/tools/commonDataManage.dart +++ b/star_lock/lib/tools/commonDataManage.dart @@ -32,6 +32,8 @@ class CommonDataManage { // get getCurrentLockUserNo => _currentLockUserNo; LockSetInfoData currentLockSetInfoData = LockSetInfoData(); + + int dayLatestTime = (86400-1)*1000; } diff --git a/star_lock/lib/tools/seletKeyCyclicDate/seletKeyCyclicDate_page.dart b/star_lock/lib/tools/seletKeyCyclicDate/seletKeyCyclicDate_page.dart index 9275ad1a..ed86b3b7 100644 --- a/star_lock/lib/tools/seletKeyCyclicDate/seletKeyCyclicDate_page.dart +++ b/star_lock/lib/tools/seletKeyCyclicDate/seletKeyCyclicDate_page.dart @@ -77,8 +77,7 @@ class _SeletKeyCyclicDatePageState extends State { Pickers.showDatePicker(context, selectDate: selectDate, mode: DateMode.YMD, onConfirm: (p) { - state.starDate.value = - DateTool().getYMDHNDateString(p, 2); + state.starDate.value = DateTool().getYMDHNDateString(p, 2); }); })), Obx(() => CommonItem( diff --git a/star_lock/pubspec.yaml b/star_lock/pubspec.yaml index 7ce89e81..4814127d 100644 --- a/star_lock/pubspec.yaml +++ b/star_lock/pubspec.yaml @@ -40,8 +40,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 1.0.30+2024043001 打包鑫锁提审ios # 1.0.31+2024050301 打包鑫锁提审华为 # 1.0.32+2024051001:打包给欧阳回归测试 +# 1.0.33+2024051401:打包给欧阳回归测试 -version: 1.0.32+2024051001 +version: 1.0.33+2024051401 environment: sdk: '>=2.12.0 <3.0.0'