diff --git a/star_lock/.gitignore b/star_lock/.gitignore index d2b4a6eb..0d4e5f39 100644 --- a/star_lock/.gitignore +++ b/star_lock/.gitignore @@ -4,6 +4,7 @@ *.pyc *.swp .DS_Store +../.DS_Store .atom/ .buildlog/ .history @@ -42,3 +43,6 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release + + + diff --git a/star_lock/images/lan/lan_en.json b/star_lock/images/lan/lan_en.json index 9519b563..36e779a9 100644 --- a/star_lock/images/lan/lan_en.json +++ b/star_lock/images/lan/lan_en.json @@ -680,6 +680,7 @@ "型号": "Model", "密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。": "After the password is generated, please use it once for activation before 23:59 on the same day, otherwise it will be invalid after 0 o'clock. After the password is activated, it can be used unlimited times within the validity period.", "密码生成后,请在当日23:59前使用,否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。": "After the password is generated, please use it before 23:59 on the same day, otherwise it will be invalid after 0 o'clock. The clear code is used to clear all the passwords generated before 0 o'clock today.", + "密码生成后,请在当日23:59前使用,否则过0点后失效。": "After the password is generated, please use it before 23:59 on the same day, otherwise it will be invalid after 0 o'clock.", "相机": "camera", "相册": "photos", "读写": "storage", @@ -839,6 +840,9 @@ "固件版本": "Firmware version", "手动升级": "Manual upgrade", "设备连接中...": "Device Connecting...", - "升级过程中无法开锁,请先开锁后再升级": "The lock cannot be unlocked during the upgrade, please unlock the lock before upgrading", - "钥匙无效": "The key is invalid" + "未避免异常情况,请在门打开时升级": "Unavoidable exceptions, please upgrade when the door is open", + "钥匙无效": "The key is invalid", + "操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。": "The operation failed. Please confirm whether the lock is nearby, or restart your phone's Bluetooth and try again.", + "如果是全自动锁,请使屏幕变亮": "If it is a fully automatic lock, please make the screen brighter", + "正在尝试闭锁……": "Attempting to lock..." } diff --git a/star_lock/images/lan/lan_keys.json b/star_lock/images/lan/lan_keys.json index 19c60d8f..4236badc 100644 --- a/star_lock/images/lan/lan_keys.json +++ b/star_lock/images/lan/lan_keys.json @@ -707,6 +707,7 @@ "型号": "型号", "密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。": "密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。", "密码生成后,请在当日23:59前使用,否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。":"密码生成后,请在当日23:59前使用,否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。", + "密码生成后,请在当日23:59前使用,否则过0点后失效。": "密码生成后,请在当日23:59前使用,否则过0点后失效。", "密码不一致哦":"密码不一致哦", "相机": "相机", @@ -867,6 +868,9 @@ "固件版本": "固件版本", "手动升级": "手动升级", "设备连接中...": "设备连接中...", - "升级过程中无法开锁,请先开锁后再升级": "升级过程中无法开锁,请先开锁后再升级", - "钥匙无效": "钥匙无效" + "未避免异常情况,请在门打开时升级": "未避免异常情况,请在门打开时升级", + "钥匙无效": "钥匙无效", + "操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。": "操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。", + "如果是全自动锁,请使屏幕变亮": "如果是全自动锁,请使屏幕变亮", + "正在尝试闭锁……": "正在尝试闭锁……" } diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index 4cfe31db..f0ce5803 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -682,6 +682,7 @@ "型号": "型号", "密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。": "密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。", "密码生成后,请在当日23:59前使用,否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。": "密码生成后,请在当日23:59前使用,否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。", + "密码生成后,请在当日23:59前使用,否则过0点后失效。": "密码生成后,请在当日23:59前使用,否则过0点后失效。", "密码不一致哦": "密码不一致哦", "相机": "相机", "相册": "相册", @@ -837,7 +838,9 @@ "固件版本": "固件版本", "手动升级": "手动升级", "设备连接中...": "设备连接中...", - "升级过程中无法开锁,请先开锁后再升级": "升级过程中无法开锁,请先开锁后再升级", - "钥匙无效": "钥匙无效" - + "未避免异常情况,请在门打开时升级": "未避免异常情况,请在门打开时升级", + "钥匙无效": "钥匙无效", + "操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。": "操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。", + "如果是全自动锁,请使屏幕变亮": "如果是全自动锁,请使屏幕变亮", + "正在尝试闭锁……": "正在尝试闭锁……" } diff --git a/star_lock/ios/Podfile.lock b/star_lock/ios/Podfile.lock index a5ddc949..1f76cd62 100644 --- a/star_lock/ios/Podfile.lock +++ b/star_lock/ios/Podfile.lock @@ -309,25 +309,25 @@ SPEC CHECKSUMS: audio_session: 088d2483ebd1dc43f51d253d4a1c517d9a2e7207 audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40 auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d - camera_avfoundation: 8b8d780bcfb6a4a02b0fbe2b4bd17b5b71946e68 + camera_avfoundation: 759172d1a77ae7be0de08fc104cfb79738b8a59e connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed DKImagePickerController: 0a24ebfe7b48beeb74c27531540aaa2cc1dac6cf DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 EMASRest: 8df6f87836767a9415ad5cc4af739bc9d215b475 file_picker: ce3938a0df3cc1ef404671531facef740d03f920 - Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 flutter_blue_plus: 4837da7d00cf5d441fdd6635b3a57f936778ea96 flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086 flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907 flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82 - fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265 + fluttertoast: 9f2f8e81bb5ce18facb9748d7855bf5a756fe3db fluwx: daa284756ce53442b3d0417ceeda66e981906811 - google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458 + google_maps_flutter_ios: f135b968a67c05679e0a53538e900b5c174b0d99 GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4 image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb - image_picker_ios: 99dfe1854b4fa34d0364e74a78448a0151025425 + image_picker_ios: b545a5f16c0fa88e3ecbbce3ed4de45567a8ec18 ios-voice-processor: 8e32d7f980a06d392d128ef1cd19cf6ddcaca3c1 JCore: 05f0f3489672ea3fa55338bae4866224bc092b1f JPush: 76668b765fcfd7c15f86b05ca0e5cdc01945ce23 @@ -335,18 +335,18 @@ SPEC CHECKSUMS: just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa network_info_plus: 6d0c3eb8367b8164fa3fb0c19875e3f59d49697f package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e - path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c + path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 ReachabilitySwift: 2128f3a8c9107e1ad33574c6e58e8285d460b149 SDWebImage: 40b0b4053e36c660a764958bff99eed16610acbb - shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 + shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4 system_settings: 8f5cdbfa72c677fc8d665b863bcc20d393d87e9d Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e - url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812 - video_player_avfoundation: 02011213dab73ae3687df27ce441fbbcc82b5579 - webview_flutter_wkwebview: 4f3e50f7273d31e5500066ed267e3ae4309c5ae4 + url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe + video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3 + webview_flutter_wkwebview: be0f0d33777f1bfd0c9fdcb594786704dbf65f36 WechatOpenSDK-XCFramework: 36fb2bea0754266c17184adf4963d7e6ff98b69f PODFILE CHECKSUM: 317f9473a5705c6fe4d79d95e81676f248048fdc diff --git a/star_lock/ios/Runner.xcodeproj/project.pbxproj b/star_lock/ios/Runner.xcodeproj/project.pbxproj index f628b2c8..82c40d25 100644 --- a/star_lock/ios/Runner.xcodeproj/project.pbxproj +++ b/star_lock/ios/Runner.xcodeproj/project.pbxproj @@ -853,6 +853,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 7D53BZAN75; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; PRODUCT_NAME = Runner; PROVISIONING_PROFILE_SPECIFIER = ""; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -868,6 +869,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = "Runner/RunnerProfile-dev.entitlements"; DEVELOPMENT_TEAM = 7D53BZAN75; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -882,6 +884,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = "Runner/RunnerRelease-dev.entitlements"; DEVELOPMENT_TEAM = 7D53BZAN75; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -896,6 +899,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = "Runner/RunnerDebug-pre.entitlements"; DEVELOPMENT_TEAM = 7D53BZAN75; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -910,6 +914,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = "Runner/RunnerProfile-pre.entitlements"; DEVELOPMENT_TEAM = 7D53BZAN75; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -924,6 +929,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = "Runner/RunnerRelease-pre.entitlements"; DEVELOPMENT_TEAM = 7D53BZAN75; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -938,6 +944,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = "Runner/RunnerDebug-sky.entitlements"; DEVELOPMENT_TEAM = NAQ5PL2DYC; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -952,6 +959,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = "Runner/RunnerProfile-sky.entitlements"; DEVELOPMENT_TEAM = NAQ5PL2DYC; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -966,6 +974,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = "Runner/RunnerRelease-sky.entitlements"; DEVELOPMENT_TEAM = NAQ5PL2DYC; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -980,6 +989,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; DEVELOPMENT_TEAM = P8997RW3V8; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -994,6 +1004,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; DEVELOPMENT_TEAM = P8997RW3V8; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -1008,6 +1019,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = "Runner/RunnerRelease-xhj.entitlements"; DEVELOPMENT_TEAM = P8997RW3V8; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; PRODUCT_NAME = Runner; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; diff --git a/star_lock/lib/appRouters.dart b/star_lock/lib/appRouters.dart index 10428878..f415e1aa 100644 --- a/star_lock/lib/appRouters.dart +++ b/star_lock/lib/appRouters.dart @@ -373,7 +373,7 @@ abstract class Routers { static const getDeviceListPage = '/getDeviceListPage'; //设备列表 static const getNameListPage = '/getNameListPage'; //姓名列表 static const authorityManagementPage = '/authorityManagementPage'; //批量授权 - static const massSendLockGroupPage = '/massSendLockGroupPage'; //群发锁分组列表 + static const massSendLockGroupListPage = '/massSendLockGroupListPage'; //群发锁分组列表 static const massSendReceiverPage = '/massSendReceiverPage'; //群发接收人 static const lockUserListPage = '/lockUserListPage'; //锁用户列表 static const administratorDetailsPage = '/administratorDetailsPage'; //管理员详情 @@ -911,7 +911,7 @@ abstract class AppRouters { name: Routers.configuringWifiPage, page: () => const ConfiguringWifiPage()), GetPage( - name: Routers.massSendLockGroupPage, + name: Routers.massSendLockGroupListPage, page: () => const MassSendLockGroupListPage()), GetPage( name: Routers.massSendReceiverPage, diff --git a/star_lock/lib/blue/blue_manage.dart b/star_lock/lib/blue/blue_manage.dart index b5027d9b..f77c35a4 100644 --- a/star_lock/lib/blue/blue_manage.dart +++ b/star_lock/lib/blue/blue_manage.dart @@ -696,7 +696,8 @@ class BlueManage { // if(bluetoothConnectDevice != null && bluetoothConnectDevice!.connectionState == BluetoothConnectionState.connected){ connectDeviceMacAddress = ""; if (bluetoothConnectionState == BluetoothConnectionState.connected) { - await bluetoothConnectDevice!.disconnect(); + //加快蓝牙断连 + await bluetoothConnectDevice!.disconnect(timeout: 1); AppLog.log("断开连接成功"); } // } diff --git a/star_lock/lib/blue/io_protocol/io_addUser.dart b/star_lock/lib/blue/io_protocol/io_addUser.dart index 890fa84c..e54463e6 100644 --- a/star_lock/lib/blue/io_protocol/io_addUser.dart +++ b/star_lock/lib/blue/io_protocol/io_addUser.dart @@ -66,8 +66,8 @@ class AddUserCommand extends SenderProtocol { return 'AddUserCommand{lockID: $lockID, authUserID: $authUserID,' 'keyID: $keyID, userID: $userID, openMode: $openMode, ' 'keyType: $keyType, ' - 'startDate:${DateTool().dateIntToYMDHNString(startDate)} , ' - 'expireDate: ${DateTool().dateIntToYMDHNString(expireDate)} , ' + 'startDate:$startDate startDateStr:${ DateTool().dateIntToYMDHNString(startDate)} , ' + 'expireDate:$expireDate expireDateStr: ${DateTool().dateIntToYMDHNString(expireDate)} , ' 'useCountLimit: $useCountLimit, isRound: $isRound, ' 'weekRound: $weekRound, startHour: $startHour, ' 'startMin: $startMin, endHour: $endHour, ' diff --git a/star_lock/lib/blue/io_protocol/io_getStarLockStatusInfo.dart b/star_lock/lib/blue/io_protocol/io_getStarLockStatusInfo.dart index 5549a8cc..1e9f064b 100644 --- a/star_lock/lib/blue/io_protocol/io_getStarLockStatusInfo.dart +++ b/star_lock/lib/blue/io_protocol/io_getStarLockStatusInfo.dart @@ -26,7 +26,7 @@ class GetStarLockStatuInfoCommand extends SenderProtocol { @override String toString() { return 'GetStarLockStatuInfoCommand{lockID: $lockID, ' - 'utcTimeStamp: ${DateTool().dateIntToYMDHNString(utcTimeStamp)}, unixTimeStamp: ${DateTool().dateIntToYMDHNString(unixTimeStamp)}, ' + 'utcTimeStamp:$utcTimeStamp utcTimeStamp: ${DateTool().dateIntToYMDHNString(utcTimeStamp)}, unixTimeStamp:unixTimeStamp unixTimeStamp: ${DateTool().dateIntToYMDHNString(unixTimeStamp)}, ' 'userID: $userID, privateKey: $privateKey}'; } diff --git a/star_lock/lib/blue/io_reply.dart b/star_lock/lib/blue/io_reply.dart index 29265b10..56c93b70 100644 --- a/star_lock/lib/blue/io_reply.dart +++ b/star_lock/lib/blue/io_reply.dart @@ -16,7 +16,6 @@ abstract class Reply{ Reply.parseData(this.commandType, List dataDetail); void errorWithStstus(int status){ - switch(status){ case 0x00: // 成功 @@ -119,7 +118,7 @@ abstract class Reply{ break; case 0x16: // 正在开锁中... - AppLog.log("$logTag ${commandType!.typeName}正在开锁中..."); + AppLog.log("$logTag ${commandType!.typeName} $status 正在开锁中..."); showErrorMessage("正在开锁中..."); break; case 0xff: @@ -129,7 +128,7 @@ abstract class Reply{ break; default: //失败 - AppLog.log("$logTag ${commandType!.typeName} 蓝牙返回其他错误问题"); + AppLog.log("$logTag ${commandType!.typeName} $status 蓝牙返回其他错误问题"); break; } } diff --git a/star_lock/lib/blue/sender_beforeDataManage.dart b/star_lock/lib/blue/sender_beforeDataManage.dart index b1ca8d5f..441f445d 100644 --- a/star_lock/lib/blue/sender_beforeDataManage.dart +++ b/star_lock/lib/blue/sender_beforeDataManage.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart'; @@ -156,17 +157,30 @@ class SenderBeforeDataManage { } LockListInfoItemEntity currentKeyInfo = CommonDataManage().currentKeyInfo; - DateTime startTime = DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.startDate! ~/ 1000); - DateTime endTime = DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.endDate! ~/ 1000); - bool isRound = currentKeyInfo.keyType == XSConstantMacro.keyTypeLoop; + DateTime? startTime; + DateTime? endTime; + var startDateTime = 0; + var endDateTime = 0; + bool isRound = false; + var useCountLimit = 0xffff; + if(currentKeyInfo.keyType == XSConstantMacro.keyTypeTime){ + // 限时 + startDateTime = currentKeyInfo.startDate! ~/ 1000; + endDateTime = currentKeyInfo.endDate! ~/ 1000; + }else if(currentKeyInfo.keyType == XSConstantMacro.keyTypeLoop){ + // 循环 + isRound = true; + startTime = DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.startDate!); + endTime = DateTime.fromMillisecondsSinceEpoch(currentKeyInfo.endDate!); - 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; - } + }else if(currentKeyInfo.keyType == XSConstantMacro.keyTypeOnce){ + // 单次 + useCountLimit = 1; + } + + AppLog.log("startTime.hour:${startTime?.hour} startTime.minute:${startTime?.minute} endTime.hour:${endTime?.hour} endTime.minute:${endTime?.minute}}"); var addUserData = AddUserCommand( lockID: BlueManage().connectDeviceName, authUserID: currentKeyInfo.senderUserId!.toString(), @@ -176,16 +190,16 @@ class SenderBeforeDataManage { keyType: 0, startDate: startDateTime, expireDate: endDateTime, - useCountLimit: 0xFFFF, + useCountLimit: useCountLimit, isRound: isRound ? 1 : 0, weekRound: isRound ? DateTool().accordingTheCycleIntoTheCorrespondingNumber( currentKeyInfo.weekDays!) : 0, - startHour: isRound ? startTime.hour : 0, - startMin: isRound ? startTime.minute : 0, - endHour: isRound ? endTime.hour : 0, - endMin: isRound ? endTime.minute : 0, + startHour: isRound ? startTime!.hour : 0, + startMin: isRound ? startTime!.minute : 0, + endHour: isRound ? endTime!.hour : 0, + endMin: isRound ? endTime!.minute : 0, role: currentKeyInfo.keyRight == 1 ? 1 : 0, password: "123456", needAuthor: 1, diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart index 5bb5dfb1..ca2ee4e9 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart @@ -214,8 +214,9 @@ class _VolumeAuthorizationLockPageState extends State; diff --git a/star_lock/lib/main/lockDetail/card/cardList/cardList_logic.dart b/star_lock/lib/main/lockDetail/card/cardList/cardList_logic.dart index c96d624a..c02dce71 100644 --- a/star_lock/lib/main/lockDetail/card/cardList/cardList_logic.dart +++ b/star_lock/lib/main/lockDetail/card/cardList/cardList_logic.dart @@ -33,13 +33,13 @@ class CardListLogic extends BaseGetXController { _replyAddICCardBegin(reply); } - if(reply is SenderCheckingCardStatusReply) { - _replyReferEventRecordNumber(reply); - } - - if(reply is SenderCheckingUserInfoCountReply){ - _replyCheckingUserInfoCount(reply); - } + // if(reply is SenderCheckingCardStatusReply) { + // _replyReferEventRecordNumber(reply); + // } + // + // if(reply is SenderCheckingUserInfoCountReply){ + // _replyCheckingUserInfoCount(reply); + // } }); } @@ -94,134 +94,134 @@ class CardListLogic extends BaseGetXController { } } - // 获取卡片状态 - Future _replyReferEventRecordNumber(Reply reply) async { - int status = reply.data[2]; - switch(status){ - case 0x00: - //成功 - // _getLockStatus(); - break; - case 0x06: - //无权限 - break; - default: - //失败 - break; - } - } + // // 获取卡片状态 + // Future _replyReferEventRecordNumber(Reply reply) async { + // int status = reply.data[2]; + // switch(status){ + // case 0x00: + // //成功 + // // _getLockStatus(); + // break; + // case 0x06: + // //无权限 + // break; + // default: + // //失败 + // break; + // } + // } + // + // // 查询用户、指纹、密码、卡片数量(用于判断是否同步) + // Future _replyCheckingUserInfoCount(Reply reply) async { + // int status = reply.data[2]; + // + // // 用户数量 + // int userNum = reply.data[5]; + // + // // 指纹数量 + // int fingerNum = reply.data[6]; + // + // // 密码数量 + // int pwdNum = reply.data[7]; + // + // // 卡片数量 + // int cardNum = reply.data[8]; + // + // // 记录数量 + // int logsNum = reply.data[9]; + // + // // 版本 + // int verNo = reply.data[10]; + // + // // 最大管理员指纹数量 + // int maxAdminFingerNum = reply.data[11]; + // + // // 最大用户指纹数量 + // int maxUserFingerNum = reply.data[12]; + // + // // 最大管理员密码数量 + // int maxAdminPassNum = reply.data[13]; + // + // // 最大用户密码数量 + // int maxUserPassNum = reply.data[14]; + // + // // 最大管理员卡片数量 + // int maxAdminCardNum = reply.data[15]; + // + // // 最大用户卡片数量 + // int maxUserCardNum = reply.data[16]; + // + // // 序列号 + // var serialNo = reply.data.sublist(17, 21); + // + // switch(status){ + // case 0x00: + // //成功 + // // _getLockStatus(); + // break; + // case 0x06: + // //需要鉴权 + // break; + // default: + // //失败 + // break; + // } + // } - // 查询用户、指纹、密码、卡片数量(用于判断是否同步) - Future _replyCheckingUserInfoCount(Reply reply) async { - int status = reply.data[2]; - - // 用户数量 - int userNum = reply.data[5]; - - // 指纹数量 - int fingerNum = reply.data[6]; - - // 密码数量 - int pwdNum = reply.data[7]; - - // 卡片数量 - int cardNum = reply.data[8]; - - // 记录数量 - int logsNum = reply.data[9]; - - // 版本 - int verNo = reply.data[10]; - - // 最大管理员指纹数量 - int maxAdminFingerNum = reply.data[11]; - - // 最大用户指纹数量 - int maxUserFingerNum = reply.data[12]; - - // 最大管理员密码数量 - int maxAdminPassNum = reply.data[13]; - - // 最大用户密码数量 - int maxUserPassNum = reply.data[14]; - - // 最大管理员卡片数量 - int maxAdminCardNum = reply.data[15]; - - // 最大用户卡片数量 - int maxUserCardNum = reply.data[16]; - - // 序列号 - var serialNo = reply.data.sublist(17, 21); - - switch(status){ - case 0x00: - //成功 - // _getLockStatus(); - break; - case 0x06: - //需要鉴权 - break; - default: - //失败 - break; - } - } - - // 查询卡片状态 - Future senderCheckingCardStatus() async { - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async { - if (state == BluetoothConnectionState.connected) { - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); - - var token = await Storage.getStringList(saveBlueToken); - List getTokenList = changeStringListToIntList(token!); - - var publicKey = await Storage.getStringList(saveBluePublicKey); - List getPublicKeyList = changeStringListToIntList(publicKey!); - - IoSenderManage.senderCheckingCardStatusCommand( - keyID:BlueManage().connectDeviceName, - userID:await Storage.getUid(), - role:0xff, - cardCount:20, - cardNo:1, - token:getTokenList, - needAuthor:1, - publicKey:getPublicKeyList, - privateKey:getPrivateKeyList, - ); - } - }); - } - - // 查询用户、指纹、密码、卡片数量(用于判断是否同步) - Future senderCheckingUserInfoCount() async { - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async { - if (state == BluetoothConnectionState.connected) { - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); - - var token = await Storage.getStringList(saveBlueToken); - List getTokenList = changeStringListToIntList(token!); - - var publicKey = await Storage.getStringList(saveBluePublicKey); - List getPublicKeyList = changeStringListToIntList(publicKey!); - - IoSenderManage.senderCheckingUserInfoCountCommand( - keyID:BlueManage().connectDeviceName, - userID:await Storage.getUid(), - role:0xff, - nowTime:DateTime.now().millisecondsSinceEpoch~/1000, - token:getTokenList, - needAuthor:1, - publicKey:getPublicKeyList, - privateKey:getPrivateKeyList, - ); - } - }); - } + // // 查询卡片状态 + // Future senderCheckingCardStatus() async { + // BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async { + // if (state == BluetoothConnectionState.connected) { + // var privateKey = await Storage.getStringList(saveBluePrivateKey); + // List getPrivateKeyList = changeStringListToIntList(privateKey!); + // + // var token = await Storage.getStringList(saveBlueToken); + // List getTokenList = changeStringListToIntList(token!); + // + // var publicKey = await Storage.getStringList(saveBluePublicKey); + // List getPublicKeyList = changeStringListToIntList(publicKey!); + // + // IoSenderManage.senderCheckingCardStatusCommand( + // keyID:BlueManage().connectDeviceName, + // userID:await Storage.getUid(), + // role:0xff, + // cardCount:20, + // cardNo:1, + // token:getTokenList, + // needAuthor:1, + // publicKey:getPublicKeyList, + // privateKey:getPrivateKeyList, + // ); + // } + // }); + // } + // + // // 查询用户、指纹、密码、卡片数量(用于判断是否同步) + // Future senderCheckingUserInfoCount() async { + // BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async { + // if (state == BluetoothConnectionState.connected) { + // var privateKey = await Storage.getStringList(saveBluePrivateKey); + // List getPrivateKeyList = changeStringListToIntList(privateKey!); + // + // var token = await Storage.getStringList(saveBlueToken); + // List getTokenList = changeStringListToIntList(token!); + // + // var publicKey = await Storage.getStringList(saveBluePublicKey); + // List getPublicKeyList = changeStringListToIntList(publicKey!); + // + // IoSenderManage.senderCheckingUserInfoCountCommand( + // keyID:BlueManage().connectDeviceName, + // userID:await Storage.getUid(), + // role:0xff, + // nowTime:DateTime.now().millisecondsSinceEpoch~/1000, + // token:getTokenList, + // needAuthor:1, + // publicKey:getPublicKeyList, + // privateKey:getPrivateKeyList, + // ); + // } + // }); + // } // 删除卡片 Future senderAddICCard() async { @@ -262,19 +262,6 @@ class CardListLogic extends BaseGetXController { privateKey:getPrivateKeyList, token: getTokenList, ); - - // IoSenderManage.senderAddICCardCommand( - // keyID:state.deletKeyID, - // userID:state.deletUserID, - // cardNo:state.deletCardNo, - // useCountLimit:0, - // startTime:0x11223344, - // endTime:0x11223344, - // needAuthor:1, - // signKey:signKeyDataList, - // privateKey:getPrivateKeyList, - // token: getTokenList, - // ); } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { dismissEasyLoading(); cancelBlueConnetctToastTimer(); diff --git a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_state.dart b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_state.dart index b0d31bab..9c4e0414 100644 --- a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_state.dart +++ b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_state.dart @@ -1,5 +1,6 @@ import 'package:get/get.dart'; +import 'package:star_lock/app_settings/app_settings.dart'; import '../../../../tools/dateTool.dart'; import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart'; @@ -25,7 +26,8 @@ class OtherTypeKeyChangeDateState{ fingerprintItemData.value = map["fingerprintItemData"]; } - if(fingerprintItemData.value.startDate == 0 && fingerprintItemData.value.endDate == 0){ + AppLog.log("fingerprintItemData.value.startDate:${fingerprintItemData.value.startDate} fingerprintItemData.value.endDate:${fingerprintItemData.value.endDate}"); + if(fingerprintItemData.value.startDate == 0){ beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()); endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()); beginTimeTimestamp.value = DateTime.now().millisecondsSinceEpoch; @@ -36,5 +38,7 @@ class OtherTypeKeyChangeDateState{ beginTimeTimestamp.value = fingerprintItemData.value.startDate!; endTimeTimestamp.value = fingerprintItemData.value.endDate!; } + + AppLog.log("beginTime.value:${beginTime.value} endTime.value:${endTime.value} beginTimeTimestamp.value:${beginTimeTimestamp.value} endTimeTimestamp.value:${endTimeTimestamp.value}"); } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart index ef9613a5..ab08598e 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart @@ -1,36 +1,44 @@ import 'dart:async'; +import 'dart:ffi'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import '../../../../../network/api_repository.dart'; import '../../../../../tools/eventBusEventManage.dart'; import 'checkingInAddStaffSelectKey_entity.dart'; import 'checkingInAddStaff_state.dart'; -typedef KeyClickCallback = void Function(List selectKeyList); -class CheckingInAddStaffLogic extends BaseGetXController{ +typedef KeyClickCallback = void Function( + List selectKeyList); + +class CheckingInAddStaffLogic extends BaseGetXController { CheckingInAddStaffState state = CheckingInAddStaffState(); // 下级界面修改成功后传递数据 StreamSubscription? _getNumberEvent; + void _initLoadDataAction() { // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus - _getNumberEvent = eventBus.on().listen((event) { - state.attendanceWayNumber.value = event.number; - isCanClickAction(); - }); + _getNumberEvent = eventBus + .on() + .listen((event) { + state.attendanceWayNumber.value = event.number; + isCanClickAction(); + }); } // 添加员工 - void addStaffLoadData() async{ + void addStaffLoadData() async { var usernameType = "1"; - if(state.appUnHaveAccount.value && state.staffAccount.contains("@")){ + if (state.appUnHaveAccount.value && state.staffAccount.contains("@")) { usernameType = "2"; } // 当是app且没有钥匙时,直接把账号赋值给attendanceWayNumber - if(state.appUnHaveAccount.value && state.selectPrintingMethodType.value == "1"){ + if (state.appUnHaveAccount.value && + state.selectPrintingMethodType.value == "1") { state.attendanceWayNumber.value = state.staffAccountController.text; } @@ -41,36 +49,38 @@ class CheckingInAddStaffLogic extends BaseGetXController{ have: state.appUnHaveAccount.value ? "2" : "1", staffName: state.staffNameController.text, countryCode: state.countryCode.value, - usernameType:usernameType, + usernameType: usernameType, ); - if(entity.errorCode!.codeIsSuccessful){ + if (entity.errorCode!.codeIsSuccessful) { eventBus.fire(RefreshCheckInSetDataEvent()); eventBus.fire(RefreshCheckInListEvent()); Get.back(result: "addScuess"); - }else if(entity.errorCode! == 425){ + } else if (entity.errorCode! == 425) { showToast(entity.errorMsg!); } } - // 考勤设置添加员工-选择钥匙 1为APP,2为密码,3为卡,4为指纹,返回数据中,attendanceWay分别为用户名、密码、卡号、指纹号 - void addStaffSelectKey(KeyClickCallback kyClickCallback) async{ + // 考勤设置添加员工-选择钥匙 1为APP,2为密码,3为卡,4为指纹,返回数据中, + // attendanceWay分别为用户名、密码、卡号、指纹号 + void addStaffSelectKey(KeyClickCallback kyClickCallback) async { var entity = await ApiRepository.to.addStaffSelectKeyData( companyId: state.companyId.value, - type:state.selectPrintingMethodType.value, + type: state.selectPrintingMethodType.value, ); - if(entity.errorCode!.codeIsSuccessful){ + if (entity.errorCode!.codeIsSuccessful) { state.keyEntity.value = entity.data!; kyClickCallback(state.keyEntity.value); } } // 编辑员工 - void editStaffLoadData() async{ + void editStaffLoadData() async { var usernameType = "1"; - if(state.appUnHaveAccount.value && state.staffAccount.contains("@")){ + if (state.appUnHaveAccount.value && state.staffAccount.contains("@")) { usernameType = "2"; } + var entity = await ApiRepository.to.editStaffData( attendanceType: state.selectPrintingMethodType.value, attendanceWay: state.attendanceWayNumber.value, @@ -126,11 +136,14 @@ class CheckingInAddStaffLogic extends BaseGetXController{ // 是否能点击 void isCanClickAction() { - if(state.selectPrintingMethodType.value == "1" && state.appUnHaveAccount.value){ + if (state.selectPrintingMethodType.value == "1" && + state.appUnHaveAccount.value) { // 没有账号的时候直接判断姓名和账号是否为空 - state.isCanClick.value = state.staffNameIsNotEmpty && state.staffAccountIsNotEmpty; - }else{ - state.isCanClick.value = state.staffNameIsNotEmpty && state.attendanceWayNumberIsNotEmpty; + state.isCanClick.value = + state.staffNameIsNotEmpty && state.staffAccountIsNotEmpty; + } else { + state.isCanClick.value = + state.staffNameIsNotEmpty && state.attendanceWayNumberIsNotEmpty; } } @@ -145,7 +158,6 @@ class CheckingInAddStaffLogic extends BaseGetXController{ @override void onInit() { - // TODO: implement onInit super.onInit(); } @@ -156,5 +168,4 @@ class CheckingInAddStaffLogic extends BaseGetXController{ _getNumberEvent!.cancel(); } - } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart index dd4b2bda..10f58706 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -6,7 +5,7 @@ import '../../../../lockMian/entity/lockListInfo_entity.dart'; import '../checkingInSetStaffList/checkingInStaffList_entity.dart'; import 'checkingInAddStaffSelectKey_entity.dart'; -class CheckingInAddStaffState{ +class CheckingInAddStaffState { final getKeyInfosData = LockListInfoItemEntity().obs; final companyId = "".obs; final staffListItemData = CheckingInAddStaffListItemEntity().obs; @@ -14,36 +13,41 @@ class CheckingInAddStaffState{ final TextEditingController staffNameController = TextEditingController(); final TextEditingController staffAccountController = TextEditingController(); - final selectPrintingMethodType = "1".obs;// 选择打卡类型 1APP 2密码 3卡 4指纹 5人脸 - final selectPrintingMethodStr = "APP".obs;// 选择打卡类型字符串 + final selectPrintingMethodType = "1".obs; // 选择打卡类型 1APP 2密码 3卡 4指纹 5人脸 + final selectPrintingMethodStr = "APP".obs; // 选择打卡类型字符串 final countryName = "中国".tr.obs; final countryCode = "86".obs; - final appUnHaveAccount = true.obs;// 默认没有账号 - final keyEntity = [].obs;// 选择钥匙数据 + final appUnHaveAccount = true.obs; // 默认没有账号 + final keyEntity = [].obs; // 选择钥匙数据 final isAdd = "1".obs; // 1添加 2编辑 final attendanceWayNumber = "".obs; final isCanClick = false.obs; var staffName = ''.obs; var staffAccount = ''.obs; + bool get staffNameIsNotEmpty => staffName.value.isNotEmpty; + bool get staffAccountIsNotEmpty => staffAccount.value.isNotEmpty; - bool get attendanceWayNumberIsNotEmpty => attendanceWayNumber.value.isNotEmpty; + + bool get attendanceWayNumberIsNotEmpty => + attendanceWayNumber.value.isNotEmpty; CheckingInAddStaffState() { Map map = Get.arguments; - getKeyInfosData.value = map["getKeyInfosData"]; - companyId.value = map["companyId"]; + getKeyInfosData.value = map["getKeyInfosData"]; + companyId.value = map["companyId"]; isAdd.value = map["isAdd"]; - if(isAdd.value == "2"){ - staffListItemData.value = map["staffListItem"]; + if (isAdd.value == "2") { + staffListItemData.value = map["staffListItem"]; staffNameController.text = staffListItemData.value.staffName!; - selectPrintingMethodType.value = staffListItemData.value.attendanceType.toString(); - switch(staffListItemData.value.attendanceType){ + selectPrintingMethodType.value = + staffListItemData.value.attendanceType.toString(); + switch (staffListItemData.value.attendanceType) { case 1: selectPrintingMethodStr.value = "APP"; break; @@ -58,17 +62,12 @@ class CheckingInAddStaffState{ break; } - if(staffListItemData.value.attendanceWay!.isNotEmpty){ - if(staffListItemData.value.cardStatus != 0){ - appUnHaveAccount.value = false; - attendanceWayNumber.value = staffListItemData.value.attendanceWay!; - }else{ - appUnHaveAccount.value = true; - } - }else{ + if (staffListItemData.value.attendanceWay!.isNotEmpty) { + appUnHaveAccount.value = false; + attendanceWayNumber.value = staffListItemData.value.attendanceWay!; + } else { appUnHaveAccount.value = true; } } } - } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart index 46effbe5..23954119 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart @@ -37,7 +37,7 @@ class CheckingInAddStaffListItemEntity { int? staffId; int? attendanceType; int? countryCode; - int? cardStatus; + int? cardStatus;//0正常 1打卡失败 String? attendanceWay; String? reason; diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart index 682865d4..6de796a0 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart @@ -137,16 +137,32 @@ class ElectronicKeyDetailLogic extends BaseGetXController { Future checkRealNameStatus(int realNameAuthStatus) async { //打开实名认证 必须输入身份证号和真实姓名 if (realNameAuthStatus == 1) { - if (state.getRealName.value.isEmpty || - state.getIDCardNumber.value.isEmpty) { - ShowCupertinoAlertView() - .showOpenAuthWithIDCardInfoAlert((idCard, realName) { - state.getIDCardNumber.value = idCard ?? ''; - state.getRealName.value = realName ?? ''; + AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace( + lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, + ); + if (entity.errorCode!.codeIsSuccessful) { + if (state.getRealName.value.isEmpty || + state.getIDCardNumber.value.isEmpty) { + ShowCupertinoAlertView() + .showOpenAuthWithIDCardInfoAlert((idCard, realName) { + state.getIDCardNumber.value = idCard ?? ''; + state.getRealName.value = realName ?? ''; + updateRealNameInfoWithAuthStatus(realNameAuthStatus); + }); + } else { updateRealNameInfoWithAuthStatus(realNameAuthStatus); - }); - } else { - updateRealNameInfoWithAuthStatus(realNameAuthStatus); + } + } else if (entity.errorCode == 432) { + //432--余量不足,需购买 + ShowCupertinoAlertView().showBuyTipWithContentAlert( + titleStr: '实名认证为付费功能,请购买后再使用'.tr, + sureClick: () { + Get.toNamed(Routers.advancedFeaturesWebPage, + arguments: {'isShop': false}); + }); + } else if (entity.errorCode == 433) { + //需联系管理员购买 + ShowCupertinoAlertView().showContactAdministratorBuyAlert(); } } else { updateRealNameInfoWithAuthStatus(realNameAuthStatus); diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart index 742d1857..c680ad7a 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart @@ -227,13 +227,16 @@ class _ElectronicKeyDetailPageState extends State { Obx( () => Visibility( // (state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false - visible: CommonDataManage() - .currentKeyInfo - .lockSetting! - .remoteUnlock == - 1 - ? true - : false, + // visible: CommonDataManage() + // .currentKeyInfo + // .lockSetting! + // .remoteUnlock == + // 1 + // ? true + // : false, + visible: (CommonDataManage().currentKeyInfo.lockSetting!.remoteUnlock == 1 && state.itemData.value.keyRight != 1) + ? true + : false, child: CommonItem( leftTitel: "远程开锁".tr, rightTitle: "", diff --git a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey/massSendElectronicKey_page.dart b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey/massSendElectronicKey_page.dart index 128557d8..c91a7c72 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey/massSendElectronicKey_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey/massSendElectronicKey_page.dart @@ -201,8 +201,9 @@ class _MassSendElectronicKeyPageState extends State { : state.lockIdList.length.toString(), isHaveDirection: true, action: () { - Navigator.pushNamed(context, Routers.massSendLockGroupPage) - .then((value) { + Navigator.pushNamed(context, Routers.massSendLockGroupListPage, arguments:{ + "keyLimits":"2", + }).then((value) { //得到选中的锁ID列表 if (value != null) { value as Map; diff --git a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey/massSendElectronicKey_state.dart b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey/massSendElectronicKey_state.dart index ab972b16..d513def2 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey/massSendElectronicKey_state.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey/massSendElectronicKey_state.dart @@ -1,5 +1,4 @@ - import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart'; import 'package:get/get.dart'; @@ -25,5 +24,4 @@ class MassSendElectronicKeyState{ var isDemoMode = false; final sendSucceedType = 0.obs; - } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_logic.dart index 238bfa6d..1f916225 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_logic.dart @@ -10,7 +10,7 @@ class MassSendLockGroupListLogic extends BaseGetXController { //分组列表请求 Future mockNetworkDataRequest() async { MassSendLockGroupListEntity entity = - await ApiRepository.to.lockGroupList('2'); + await ApiRepository.to.lockGroupList(state.keyLimits); if (entity.errorCode!.codeIsSuccessful) { if (entity.data != null) { state.lockGroupList.value = entity.data!.groupList!; diff --git a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_state.dart b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_state.dart index e344db01..94c259a3 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_state.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_state.dart @@ -4,4 +4,12 @@ class MassSendLockGroupListState { var lockGroupList = [].obs; var selectLockIdList = [].obs; var isVip = false.obs; + + var keyLimits = '';// 1管理员(包括超级管理员跟管理员) 2普通用户 + MassSendLockGroupListState(){ + Map map = Get.arguments; + if(map["keyLimits"] != null){ + keyLimits = map['keyLimits']; + } + } } diff --git a/star_lock/lib/main/lockDetail/face/faceList/faceList_logic.dart b/star_lock/lib/main/lockDetail/face/faceList/faceList_logic.dart index 64a555e3..432d7cab 100644 --- a/star_lock/lib/main/lockDetail/face/faceList/faceList_logic.dart +++ b/star_lock/lib/main/lockDetail/face/faceList/faceList_logic.dart @@ -28,18 +28,18 @@ class FaceListLogic extends BaseGetXController { _replySubscription = EventBusManager().eventBus!.on().listen((reply) { // 添加人脸开始(此处用作删除人脸) - if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen == true)) { + if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen.value == true)) { _replyAddFaceBegin(reply); } - if (reply is SenderQueryingFaceStatusReply) { - // 获取人脸状态 - _replyQueryingFaceStatus(reply); - } - - if (reply is SenderCheckingUserInfoCountReply) { - _replyCheckingUserInfoCount(reply); - } + // if (reply is SenderQueryingFaceStatusReply) { + // // 获取人脸状态 + // _replyQueryingFaceStatus(reply); + // } + // + // if (reply is SenderCheckingUserInfoCountReply) { + // _replyCheckingUserInfoCount(reply); + // } }); } @@ -89,19 +89,6 @@ class FaceListLogic extends BaseGetXController { privateKey:getPrivateKeyList, token: token, ); - - // IoSenderManage.senderAddFaceCommand( - // keyID: state.deletKeyID, - // userID: state.deletUserID, - // faceNo: state.deletFaceNo, - // useCountLimit: 0, - // startTime: 0x11223344, - // endTime: 0x11223344, - // needAuthor: 1, - // publicKey: publicKeyDataList, - // privateKey: getPrivateKeyList, - // token: getTokenList, - // ); break; default: //失败 @@ -109,158 +96,158 @@ class FaceListLogic extends BaseGetXController { } } - // 获取人脸状态 - Future _replyQueryingFaceStatus(Reply reply) async { - int status = reply.data[2]; + // // 获取人脸状态 + // Future _replyQueryingFaceStatus(Reply reply) async { + // int status = reply.data[2]; + // + // switch (status) { + // case 0x00: + // //成功 + // // _getLockStatus(); + // break; + // case 0x06: + // //无权限 + // + // break; + // default: + // //失败 + // break; + // } + // } - switch (status) { - case 0x00: - //成功 - // _getLockStatus(); - break; - case 0x06: - //无权限 + // // 获取卡片状态 + // Future _replyReferEventRecordNumber(Reply reply) async { + // int status = reply.data[2]; + // switch (status) { + // case 0x00: + // //成功 + // + // // _getLockStatus(); + // break; + // case 0x06: + // //无权限 需要鉴权 + // + // break; + // default: + // //失败 + // break; + // } + // } - break; - default: - //失败 - break; - } - } + // // 查询用户、指纹、密码、卡片数量(用于判断是否同步) + // Future _replyCheckingUserInfoCount(Reply reply) async { + // int status = reply.data[2]; + // + // // 用户数量 + // int userNum = reply.data[5]; + // + // // 指纹数量 + // int fingerNum = reply.data[6]; + // + // // 密码数量 + // int pwdNum = reply.data[7]; + // + // // 卡片数量 + // int cardNum = reply.data[8]; + // + // // 记录数量 + // int logsNum = reply.data[9]; + // + // // 版本 + // int verNo = reply.data[10]; + // + // // 最大管理员指纹数量 + // int maxAdminFingerNum = reply.data[11]; + // + // // 最大用户指纹数量 + // int maxUserFingerNum = reply.data[12]; + // + // // 最大管理员密码数量 + // int maxAdminPassNum = reply.data[13]; + // + // // 最大用户密码数量 + // int maxUserPassNum = reply.data[14]; + // + // // 最大管理员卡片数量 + // int maxAdminCardNum = reply.data[15]; + // + // // 最大用户卡片数量 + // int maxUserCardNum = reply.data[16]; + // + // // 序列号 + // var serialNo = reply.data.sublist(17, 21); + // + // switch (status) { + // case 0x00: + // //成功 + // // _getLockStatus(); + // break; + // case 0x06: + // //无权限 + // + // break; + // default: + // //失败 + // break; + // } + // } - // 获取卡片状态 - Future _replyReferEventRecordNumber(Reply reply) async { - int status = reply.data[2]; - switch (status) { - case 0x00: - //成功 + // // 获取人脸状态 + // Future senderQueryingFaceStatus() async { + // BlueManage().bludSendData(BlueManage().connectDeviceName, + // (BluetoothConnectionState state) async { + // if (state == BluetoothConnectionState.connected) { + // var privateKey = await Storage.getStringList(saveBluePrivateKey); + // List getPrivateKeyList = changeStringListToIntList(privateKey!); + // + // var token = await Storage.getStringList(saveBlueToken); + // List getTokenList = changeStringListToIntList(token!); + // + // var publicKey = await Storage.getStringList(saveBluePublicKey); + // List getPublicKeyList = changeStringListToIntList(publicKey!); + // + // IoSenderManage.senderQueryingFaceStatusCommand( + // keyID: BlueManage().connectDeviceName, + // userID: await Storage.getUid(), + // role: 0xff, + // faceCount: 20, + // faceNo: 1, + // token: getTokenList, + // needAuthor: 1, + // publicKey: getPublicKeyList, + // privateKey: getPrivateKeyList, + // ); + // } + // }); + // } - // _getLockStatus(); - break; - case 0x06: - //无权限 需要鉴权 - - break; - default: - //失败 - break; - } - } - - // 查询用户、指纹、密码、卡片数量(用于判断是否同步) - Future _replyCheckingUserInfoCount(Reply reply) async { - int status = reply.data[2]; - - // 用户数量 - int userNum = reply.data[5]; - - // 指纹数量 - int fingerNum = reply.data[6]; - - // 密码数量 - int pwdNum = reply.data[7]; - - // 卡片数量 - int cardNum = reply.data[8]; - - // 记录数量 - int logsNum = reply.data[9]; - - // 版本 - int verNo = reply.data[10]; - - // 最大管理员指纹数量 - int maxAdminFingerNum = reply.data[11]; - - // 最大用户指纹数量 - int maxUserFingerNum = reply.data[12]; - - // 最大管理员密码数量 - int maxAdminPassNum = reply.data[13]; - - // 最大用户密码数量 - int maxUserPassNum = reply.data[14]; - - // 最大管理员卡片数量 - int maxAdminCardNum = reply.data[15]; - - // 最大用户卡片数量 - int maxUserCardNum = reply.data[16]; - - // 序列号 - var serialNo = reply.data.sublist(17, 21); - - switch (status) { - case 0x00: - //成功 - // _getLockStatus(); - break; - case 0x06: - //无权限 - - break; - default: - //失败 - break; - } - } - - // 获取人脸状态 - Future senderQueryingFaceStatus() async { - BlueManage().bludSendData(BlueManage().connectDeviceName, - (BluetoothConnectionState state) async { - if (state == BluetoothConnectionState.connected) { - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); - - var token = await Storage.getStringList(saveBlueToken); - List getTokenList = changeStringListToIntList(token!); - - var publicKey = await Storage.getStringList(saveBluePublicKey); - List getPublicKeyList = changeStringListToIntList(publicKey!); - - IoSenderManage.senderQueryingFaceStatusCommand( - keyID: BlueManage().connectDeviceName, - userID: await Storage.getUid(), - role: 0xff, - faceCount: 20, - faceNo: 1, - token: getTokenList, - needAuthor: 1, - publicKey: getPublicKeyList, - privateKey: getPrivateKeyList, - ); - } - }); - } - - // 查询用户、指纹、密码、卡片数量(用于判断是否同步) - Future senderCheckingUserInfoCount() async { - BlueManage().bludSendData(BlueManage().connectDeviceName, - (BluetoothConnectionState state) async { - if (state == BluetoothConnectionState.connected) { - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); - - var token = await Storage.getStringList(saveBlueToken); - List getTokenList = changeStringListToIntList(token!); - - var publicKey = await Storage.getStringList(saveBluePublicKey); - List getPublicKeyList = changeStringListToIntList(publicKey!); - - IoSenderManage.senderCheckingUserInfoCountCommand( - keyID: BlueManage().connectDeviceName, - userID: await Storage.getUid(), - role: 0xff, - nowTime: DateTime.now().millisecondsSinceEpoch ~/ 1000, - token: getTokenList, - needAuthor: 1, - publicKey: getPublicKeyList, - privateKey: getPrivateKeyList, - ); - } - }); - } + // // 查询用户、指纹、密码、卡片数量(用于判断是否同步) + // Future senderCheckingUserInfoCount() async { + // BlueManage().bludSendData(BlueManage().connectDeviceName, + // (BluetoothConnectionState state) async { + // if (state == BluetoothConnectionState.connected) { + // var privateKey = await Storage.getStringList(saveBluePrivateKey); + // List getPrivateKeyList = changeStringListToIntList(privateKey!); + // + // var token = await Storage.getStringList(saveBlueToken); + // List getTokenList = changeStringListToIntList(token!); + // + // var publicKey = await Storage.getStringList(saveBluePublicKey); + // List getPublicKeyList = changeStringListToIntList(publicKey!); + // + // IoSenderManage.senderCheckingUserInfoCountCommand( + // keyID: BlueManage().connectDeviceName, + // userID: await Storage.getUid(), + // role: 0xff, + // nowTime: DateTime.now().millisecondsSinceEpoch ~/ 1000, + // token: getTokenList, + // needAuthor: 1, + // publicKey: getPublicKeyList, + // privateKey: getPrivateKeyList, + // ); + // } + // }); + // } // 删除人脸 Future senderAddFace() async { @@ -311,16 +298,26 @@ class FaceListLogic extends BaseGetXController { } // 获取人脸列表 - void getFaceListData() async { + Future getFaceListData() async { var entity = await ApiRepository.to.getFaceListData( lockId: state.lockId.value.toString(), - pageNo: '1', - pageSize: '20', + pageNo: pageNo.toString(), + pageSize: pageSize.toString(), searchStr: state.searchController.text, ); if (entity.errorCode!.codeIsSuccessful) { - state.faceItemListData.value = entity.data!.list!; + // state.faceItemListData.value = entity.data!.list!; + if (pageNo == 1) { + state.faceItemListData.value = entity.data!.list!; + pageNo++; + } else { + if (entity.data!.list!.isNotEmpty) { + state.faceItemListData.value.addAll(entity.data!.list!); + pageNo++; + } + } } + return entity; } // 删除的人脸 @@ -336,8 +333,10 @@ class FaceListLogic extends BaseGetXController { lockId: state.lockId.value, ); if (entity.errorCode!.codeIsSuccessful) { - showToast("删除成功"); - getFaceListData(); + showToast("删除成功", something: (){ + pageNo = 1; + getFaceListData(); + }); } } @@ -353,8 +352,10 @@ class FaceListLogic extends BaseGetXController { lockId: state.lockId.value, ); if (entity.errorCode!.codeIsSuccessful) { - showToast("重置成功"); - getFaceListData(); + showToast("重置成功", something: (){ + pageNo = 1; + getFaceListData(); + }); } } @@ -388,6 +389,7 @@ class FaceListLogic extends BaseGetXController { late StreamSubscription _teamEvent; void _initRefreshAction() { _teamEvent = eventBus.on().listen((event) { + pageNo = 1; getFaceListData(); }); } @@ -403,8 +405,6 @@ class FaceListLogic extends BaseGetXController { _initReplySubscription(); _initRefreshAction(); - - getFaceListData(); } } diff --git a/star_lock/lib/main/lockDetail/face/faceList/faceList_page.dart b/star_lock/lib/main/lockDetail/face/faceList/faceList_page.dart index 0f6d9352..a9f13995 100644 --- a/star_lock/lib/main/lockDetail/face/faceList/faceList_page.dart +++ b/star_lock/lib/main/lockDetail/face/faceList/faceList_page.dart @@ -10,6 +10,7 @@ import 'package:star_lock/tools/showTipView.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; +import '../../../../tools/EasyRefreshTool.dart'; import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/noData.dart'; import '../../../../tools/storage.dart'; @@ -29,6 +30,23 @@ class _FaceListPageState extends State with RouteAware { final logic = Get.put(FaceListLogic()); final state = Get.find().state; + Future getHttpData() async { + var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); + if (isDemoMode == false) { + logic.getFaceListData().then((FingerprintListDataEntity value){ + if(mounted) setState(() {}); + }); + } + } + + @override + void initState() { + super.initState(); + + getHttpData(); + } + + @override Widget build(BuildContext context) { return Scaffold( @@ -62,34 +80,45 @@ class _FaceListPageState extends State with RouteAware { ), ], ), - body: Column( - children: [ - KeySearchWidget( - editingController: state.searchController, - onSubmittedAction: () { - logic.getFaceListData(); - }, - ), - SizedBox( - height: 20.h, - ), - Expanded(child: _buildMainUI()), - AddBottomWhiteBtn( - btnName: - '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.face!.tr}', - onClick: () async { - var data = - await Get.toNamed(Routers.addFaceTypePage, arguments: { - "lockId": state.lockId.value, - "fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入 - }); - if (data != null) { - logic.getFaceListData(); - } - }, - ), - SizedBox(height: 64.h) - ], + body: EasyRefreshTool( + onRefresh: (){ + logic.pageNo = 1; + getHttpData(); + }, + onLoad: (){ + getHttpData(); + }, + child: Column( + children: [ + KeySearchWidget( + editingController: state.searchController, + onSubmittedAction: () { + logic.pageNo = 1; + getHttpData(); + }, + ), + SizedBox( + height: 20.h, + ), + Expanded(child: _buildMainUI()), + AddBottomWhiteBtn( + btnName: + '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.face!.tr}', + onClick: () async { + var data = + await Get.toNamed(Routers.addFaceTypePage, arguments: { + "lockId": state.lockId.value, + "fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入 + }); + if (data != null) { + logic.pageNo = 1; + getHttpData(); + } + }, + ), + SizedBox(height: 64.h) + ], + ), ), ); } diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index cff7ebb3..1c33189a 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -5,6 +5,7 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:get/get.dart'; import 'package:intl/intl.dart'; import 'package:permission_handler/permission_handler.dart'; +import 'package:star_lock/blue/io_protocol/io_getStarLockStatusInfo.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/widget/permission/permission_dialog.dart'; @@ -40,26 +41,11 @@ class LockDetailLogic extends BaseGetXController { _replyOpenLock(reply); } - // 编辑锁用户 - // if(reply is EditUserReply){ - // _replyEditUserKey(reply); - // } - - // 获取星锁状态信息 - // if (reply is GetStarLockStatuInfoReply && state.ifCurrentScreen.value == true) { - // _replyGetStarLockStatusInfo(reply); - // } - // 开完锁之后上传记录 if (reply is SenderReferEventRecordTimeReply && state.ifCurrentScreen.value == true) { _replyReferEventRecordTime(reply); } - - // 添加用户 - // if ((reply is AddUserReply) && (state.ifCurrentScreen.value == true)) { - // _replyAddUserKey(reply); - // } }); } @@ -74,10 +60,7 @@ class LockDetailLogic extends BaseGetXController { cancelBlueConnetctToastTimer(); state.iSClosedUnlockSuccessfulPopup.value = true; - if (state.closedUnlockSuccessfulTimer != null) { - state.closedUnlockSuccessfulTimer!.cancel(); - state.closedUnlockSuccessfulTimer = null; - } + state.closedUnlockSuccessfulTimer?.cancel(); // 如果没有点击关闭弹窗,3秒后自动关闭 state.closedUnlockSuccessfulTimer = Timer.periodic(3.seconds, (timer) { state.iSClosedUnlockSuccessfulPopup.value = false; @@ -98,9 +81,7 @@ class LockDetailLogic extends BaseGetXController { uploadElectricQuantityRequest(); getLockRecordLastUploadDataTime(); - state.openLockBtnState.value = 0; - - eventBus.fire(RefreshLockDetailInfoDataEvent()); + resetOpenDoorState(); break; case 0x06: //无权限 @@ -128,49 +109,77 @@ class LockDetailLogic extends BaseGetXController { break; case 0x16: // 正在开锁中... - state.openLockBtnState.value = 0; - eventBus.fire(RefreshLockDetailInfoDataEvent()); + resetOpenDoorState(); showToast("正在开锁中...".tr, something: () { cancelBlueConnetctToastTimer(); }); break; case 0x0d: - // 正在开锁中... + // 钥匙无效 showToast('钥匙无效'.tr); - state.openLockBtnState.value = 0; - state.openDoorBtnisUneable.value = false; - state.animationController!.stop(); + // state.animationController!.stop(); + resetOpenDoorState(); cancelBlueConnetctToastTimer(); + BlueManage().disconnect(); + break; + case 0x0b: + // 钥匙无效 + showToast('钥匙过期'.tr); + resetOpenDoorState(); + + cancelBlueConnetctToastTimer(); + BlueManage().disconnect(); + break; + case 0x0a: + // 钥匙不存在 + showToast("钥匙不存在"); + resetOpenDoorState(); + + cancelBlueConnetctToastTimer(); + BlueManage().disconnect(); + break; + case 0x0c: + // 钥匙数量已到上限 + showToast("钥匙数量已到上限"); + resetOpenDoorState(); + + cancelBlueConnetctToastTimer(); + BlueManage().disconnect(); + break; + case 0x0e: + // 钥匙已存在 + showToast("钥匙已存在"); + resetOpenDoorState(); + + cancelBlueConnetctToastTimer(); + BlueManage().disconnect(); + break; + case 0x0f: + // 用户已存在 + showToast("用户已存在"); + resetOpenDoorState(); + + cancelBlueConnetctToastTimer(); + BlueManage().disconnect(); break; default: //失败 - state.openLockBtnState.value = 0; - state.openDoorBtnisUneable.value = false; - state.animationController!.stop(); + AppLog.log("开锁失败"); + // state.animationController!.stop(); + resetOpenDoorState(); cancelBlueConnetctToastTimer(); + BlueManage().disconnect(); break; } } - // 获取锁状态数据解析 - // Future _replyGetStarLockStatusInfo(Reply reply) async { - // int status = reply.data[2]; - // switch (status) { - // case 0x00: - // //成功 - // dismissEasyLoading(); - // cancelBlueConnetctToastTimer(); - // - // break; - // case 0x06: - // //无权限 - // - // break; - // default: - // //失败 - // break; - // } - // } + //清除开锁动画以及状态 + void closeLuckStatus() { + state.openLockBtnState.value = 0; + state.openDoorBtnisUneable.value = false; + state.animationController!.stop(canceled: true); + cancelBlueConnetctToastTimer(); + } // 根据时间查解析数据 Future _replyReferEventRecordTime(Reply reply) async { @@ -234,123 +243,12 @@ class LockDetailLogic extends BaseGetXController { } } - // // 添加用户 - // Future _replyAddUserKey(Reply reply) async { - // var lockId = reply.data.sublist(2, 42); - // - // var token = reply.data.sublist(42, 46); - // List strTokenList = changeIntListToStringList(token); - // Storage.setStringList(saveBlueToken, strTokenList); - // - // int status = reply.data[46]; - // - // switch (status) { - // case 0x00: - // //成功 - // cancelBlueConnetctToastTimer(); - // state.lockUserNo = reply.data[47]; - // _updateLockUserNo(); - // - // break; - // case 0x06: - // //无权限 - // var privateKey = await Storage.getStringList(saveBluePrivateKey); - // List getPrivateKeyList = changeStringListToIntList(privateKey!); - // - // var publicKey = await Storage.getStringList(saveBluePublicKey); - // List publicKeyDataList = changeStringListToIntList(publicKey!); - // - // IoSenderManage.senderAddUser( - // lockID: BlueManage().connectDeviceName, - // authUserID: state.senderUserId.toString(), - // keyID: state.keyInfos.value.keyId.toString(), - // userID: await Storage.getUid(), - // openMode: 1, - // keyType: 0, - // startDate: state.keyInfos.value.startDate!~/10000, - // expireDate: state.keyInfos.value.endDate!~/10000, - // role: state.keyInfos.value.keyRight == 1 ? 1 : 0, - // password: "0", - // needAuthor: 1, - // publicKey: publicKeyDataList, - // privateKey: getPrivateKeyList, - // token: token); - // break; - // default: - // break; - // } - // } - - // 添加用户(普通用户接收电子钥匙) - // Future addUserConnectBlue() async { - // showBlueConnetctToastTimer(action: () { - // state.openLockBtnState.value = 0; - // eventBus.fire(RefreshLockDetailInfoDataEvent()); - // }); - // - // // var listData = AddUserCommand( - // // lockID: BlueManage().connectDeviceName, - // // authUserID: state.senderUserId.toString(), - // // keyID: state.keyInfos.value.keyId.toString(), - // // userID: await Storage.getUid(), - // // openMode: 1, - // // keyType: 0, - // // startDate: state.keyInfos.value.startDate!~/10000, - // // expireDate: state.keyInfos.value.endDate!~/10000, - // // role: state.keyInfos.value.keyRight == 1 ? 1 : 0, - // // password: "123456", - // // needAuthor: 1, - // // publicKey: publicKeyDataList, - // // privateKey: getPrivateKeyList, - // // token: getTokenList).packageData(); - // BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (BluetoothConnectionState deviceConnectionState) async { - // if (deviceConnectionState == BluetoothConnectionState.connected) { - // // 私钥 - // var privateKey = await Storage.getStringList(saveBluePrivateKey); - // List getPrivateKeyList = changeStringListToIntList(privateKey!); - // - // var publicKey = await Storage.getStringList(saveBluePublicKey); - // List publicKeyDataList = changeStringListToIntList(publicKey!); - // - // var token = await Storage.getStringList(saveBlueToken); - // List getTokenList = [0, 0, 0, 0]; - // if (token != null) { - // getTokenList = changeStringListToIntList(token); - // } - // - // IoSenderManage.senderAddUser( - // lockID: BlueManage().connectDeviceName, - // authUserID: state.senderUserId.toString(), - // keyID: state.keyInfos.value.keyId.toString(), - // userID: await Storage.getUid(), - // openMode: 1, - // keyType: 0, - // startDate: state.keyInfos.value.startDate!~/10000, - // expireDate: state.keyInfos.value.endDate!~/10000, - // role: state.keyInfos.value.keyRight == 1 ? 1 : 0, - // password: "0", - // needAuthor: 1, - // publicKey: publicKeyDataList, - // privateKey: getPrivateKeyList, - // token: getTokenList); - // } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { - // cancelBlueConnetctToastTimer(); - // if (state.ifCurrentScreen.value == true) { - // showBlueConnetctToast(); - // } - // - // state.openLockBtnState.value = 0; - // eventBus.fire(RefreshLockDetailInfoDataEvent()); - // } - // }); - // } - // 点击开门事件 Future openDoorAction() async { showBlueConnetctToastTimer(action: () { - state.openLockBtnState.value = 0; + resetOpenDoorState(); // BlueManage().stopScan(); - eventBus.fire(RefreshLockDetailInfoDataEvent()); + BlueManage().disconnect(); }); var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -383,8 +281,7 @@ class LockDetailLogic extends BaseGetXController { showBlueConnetctToast(); } - state.openLockBtnState.value = 0; - eventBus.fire(RefreshLockDetailInfoDataEvent()); + resetOpenDoorState(); } }); } @@ -448,8 +345,7 @@ class LockDetailLogic extends BaseGetXController { openDoorAction(); } else { showToast("网络访问失败,请检查网络是否正常".tr, something: () { - state.openLockBtnState.value = 0; - state.animationController!.forward(); + resetOpenDoorState(); cancelBlueConnetctToastTimer(); state.lockNetToken = "0"; openDoorAction(); @@ -473,25 +369,6 @@ class LockDetailLogic extends BaseGetXController { } } - // 普通用户接收电子钥匙之后 更新锁用户NO - // void _updateLockUserNo() async { - // LockNetTokenEntity entity = await ApiRepository.to.updateLockUserNo( - // keyId: state.keyInfos.value.keyId.toString(), - // lockUserNo: state.lockUserNo.toString() - // ); - // if (entity.errorCode!.codeIsSuccessful) { - // eventBus.fire(RefreshLockDetailInfoDataEvent()); - // SchedulerBinding.instance.addPostFrameCallback((_) { - // eventBus.fire(RefreshLockListInfoDataEvent()); - // }); - // if (state.isOpenLockNeedOnline.value == 0) { - // openDoorAction(); - // } else { - // getLockNetToken(); - // } - // } - // } - // 查询锁记录最后时间 void getLockRecordLastUploadDataTime() async { LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to @@ -599,6 +476,14 @@ class LockDetailLogic extends BaseGetXController { return formattedTime; } + void resetOpenDoorState() { + state.openLockBtnState.value = 0; + state.openDoorBtnisUneable.value = false; + state.animationController!.reset(); + state.animationController!.forward(); + eventBus.fire(RefreshLockDetailInfoDataEvent()); + } + @override Future onReady() async { super.onReady(); diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index 8e6cde2a..4c0998ef 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:intl/intl.dart'; @@ -94,8 +95,10 @@ class _LockDetailPageState extends State state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) { state.openDoorBtnisUneable.value = false; + state.bottomBtnisEable.value = false; } else { state.openDoorBtnisUneable.value = true; + state.bottomBtnisEable.value = true; } state.isOnlyOneData = widget.isOnlyOneData; @@ -400,9 +403,8 @@ class _LockDetailPageState extends State children: [ Visibility( visible: - ((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime || - state.keyInfos.value.keyType == - XSConstantMacro.keyTypeLoop) && // 限时、循环 + ((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime || state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) + && // 限时、循环 (DateTool().compareTimeGetDaysFromNow( state.keyInfos.value.endDate!) <= 15 && @@ -875,7 +877,7 @@ class _LockDetailPageState extends State // 新增配件 showWidgetArr.add(bottomItem('images/main/icon_main_addLock.png', '新增配件'.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { + state.bottomBtnisEable.value, () { Navigator.pushNamed(context, Routers.accessoriesListPage); })); @@ -914,7 +916,6 @@ class _LockDetailPageState extends State showWidgetArr.add(bottomItem( 'images/main/icon_main_clockingIn.png', TranslationLoader.lanKeys!.checkingIn!.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { Get.toNamed(Routers.checkingInListPage, arguments: state.keyInfos.value); @@ -924,7 +925,6 @@ class _LockDetailPageState extends State showWidgetArr.add(bottomItem( 'images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { Get.toNamed(Routers.lockOperatingRecordPage, arguments: {"keyInfo": state.keyInfos.value}); @@ -932,7 +932,7 @@ class _LockDetailPageState extends State // 设置 showWidgetArr.add(bottomItem('images/main/icon_main_set.png', - TranslationLoader.lanKeys!.set!.tr, true, true, () { + TranslationLoader.lanKeys!.set!.tr, true, () { Get.toNamed(Routers.lockSetPage, arguments: { "lockId": state.keyInfos.value.lockId, "isOnlyOneData": state.isOnlyOneData @@ -950,7 +950,6 @@ class _LockDetailPageState extends State showWidgetArr.add(bottomItem( 'images/main/icon_main_clockingIn.png', TranslationLoader.lanKeys!.checkingIn!.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { Get.toNamed(Routers.checkingInListPage, arguments: state.keyInfos.value); @@ -961,7 +960,6 @@ class _LockDetailPageState extends State showWidgetArr.add(bottomItem( 'images/main/icon_main_electronicKey.png', TranslationLoader.lanKeys!.electronicKey!.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { Get.toNamed(Routers.electronicKeyListPage); })); @@ -970,7 +968,6 @@ class _LockDetailPageState extends State showWidgetArr.add(bottomItem( 'images/main/icon_main_password.png', TranslationLoader.lanKeys!.password!.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { Get.toNamed(Routers.passwordKeyListPage, arguments: {"keyInfo": state.keyInfos.value}); @@ -981,7 +978,6 @@ class _LockDetailPageState extends State showWidgetArr.add(bottomItem( 'images/main/icon_main_icCard.png', TranslationLoader.lanKeys!.card!.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { Get.toNamed(Routers.cardListPage, arguments: { "lockId": state.keyInfos.value.lockId, @@ -994,7 +990,6 @@ class _LockDetailPageState extends State showWidgetArr.add(bottomItem( 'images/main/icon_main_fingerprint.png', TranslationLoader.lanKeys!.fingerprint!.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { Get.toNamed(Routers.fingerprintListPage, arguments: { "lockId": state.keyInfos.value.lockId, @@ -1007,7 +1002,6 @@ class _LockDetailPageState extends State showWidgetArr.add(bottomItem( 'images/main/icon_main_remoteControl.png', TranslationLoader.lanKeys!.remoteControl!.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { Get.toNamed(Routers.remoteControlListPage); })); @@ -1019,7 +1013,6 @@ class _LockDetailPageState extends State bottomItem( 'images/main/icon_face.png', TranslationLoader.lanKeys!.humanFace!.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { Get.toNamed(Routers.faceListPage, arguments: { "lockId": state.keyInfos.value.lockId, @@ -1031,7 +1024,7 @@ class _LockDetailPageState extends State if (state.keyInfos.value.lockFeature!.isSupportIris == 1) { showWidgetArr.add( bottomItem('images/main/icon_iris.png', '虹膜'.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { + state.bottomBtnisEable.value, () { Get.toNamed(Routers.irisListPage, arguments: { "lockId": state.keyInfos.value.lockId, }); @@ -1042,7 +1035,7 @@ class _LockDetailPageState extends State if (state.keyInfos.value.lockFeature!.palmVein == 1) { showWidgetArr.add( bottomItem('images/main/icon_palm.png', '手掌'.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { + state.bottomBtnisEable.value, () { Get.toNamed(Routers.palmListPage, arguments: { "lockId": state.keyInfos.value.lockId, }); @@ -1056,7 +1049,6 @@ class _LockDetailPageState extends State bottomItem( 'images/main/icon_catEyes.png', TranslationLoader.lanKeys!.monitoring!.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { Get.toNamed(Routers.realTimePicturePage, arguments: { "lockName": state.keyInfos.value.lockName, @@ -1071,7 +1063,6 @@ class _LockDetailPageState extends State showWidgetArr.add(bottomItem( 'images/main/icon_main_authorizedAdmin.png', TranslationLoader.lanKeys!.authorizedAdmin!.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { Get.toNamed(Routers.authorizedAdminListPage, arguments: {"keyInfo": state.keyInfos.value}); @@ -1084,7 +1075,6 @@ class _LockDetailPageState extends State bottomItem( 'images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { // Get.toNamed(Routers.lockOperatingRecordPage, // arguments: {"keyInfo": state.keyInfos.value}); @@ -1098,7 +1088,6 @@ class _LockDetailPageState extends State endWiddget.add(bottomItem( 'images/main/icon_lockDetail_videoLog.png', TranslationLoader.lanKeys!.videoLog!.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { Get.toNamed(Routers.videoLogPage, arguments: { "lockId": state.keyInfos.value.lockId, @@ -1110,7 +1099,6 @@ class _LockDetailPageState extends State bottomItem( 'images/main/icon_lockDetail_messageReminding.png', TranslationLoader.lanKeys!.messageReminding!.tr, - state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () { Get.toNamed(Routers.msgNotificationPage, arguments: { "lockId": state.keyInfos.value.lockId, @@ -1121,7 +1109,7 @@ class _LockDetailPageState extends State endWiddget.add( // 设置 bottomItem('images/main/icon_main_set.png', - TranslationLoader.lanKeys!.set!.tr, true, true, () { + TranslationLoader.lanKeys!.set!.tr, true, () { // logic.clickItemBtnAction(10); Get.toNamed(Routers.lockSetPage, arguments: { "lockId": state.keyInfos.value.lockId, @@ -1133,8 +1121,7 @@ class _LockDetailPageState extends State return showWidgetArr; } - Widget bottomItem(String iconUrl, String name, bool openDoorBtnisUneable, - bool bottomBtnisEable, Function() onClick) { + Widget bottomItem(String iconUrl, String name, bool bottomBtnisEable, Function() onClick) { Widget child = F.sw( defaultCall: () => Container( color: Colors.white, @@ -1149,10 +1136,8 @@ class _LockDetailPageState extends State child: Image.asset(iconUrl, width: 42.w, height: 42.w, - color: openDoorBtnisUneable - ? (bottomBtnisEable - ? AppColors.mainColor - : AppColors.lockDetailBottomBtnUneable) + color: bottomBtnisEable + ? AppColors.mainColor : AppColors.lockDetailBottomBtnUneable, fit: BoxFit.fitWidth), ), @@ -1162,11 +1147,7 @@ class _LockDetailPageState extends State child: Text(name, style: TextStyle( fontSize: 20.sp, - color: openDoorBtnisUneable - ? (bottomBtnisEable - ? AppColors.blackColor - : AppColors.lockDetailBottomBtnUneable) - : AppColors.lockDetailBottomBtnUneable), + color: bottomBtnisEable ? AppColors.blackColor : AppColors.lockDetailBottomBtnUneable), textAlign: TextAlign.center)) ], ), @@ -1186,10 +1167,8 @@ class _LockDetailPageState extends State child: Image.asset(iconUrl, width: 42.w, height: 42.w, - color: openDoorBtnisUneable - ? (bottomBtnisEable - ? AppColors.mainColor - : AppColors.lockDetailBottomBtnUneable) + color: bottomBtnisEable + ? AppColors.mainColor : AppColors.lockDetailBottomBtnUneable, fit: BoxFit.fitWidth), ), @@ -1199,23 +1178,19 @@ class _LockDetailPageState extends State name, style: TextStyle( fontSize: 20.sp, - color: openDoorBtnisUneable - ? (bottomBtnisEable - ? AppColors.blackColor - : AppColors.lockDetailBottomBtnUneable) + color: bottomBtnisEable + ? AppColors.blackColor : AppColors.lockDetailBottomBtnUneable), ), ], ), )); return GestureDetector( - onTap: openDoorBtnisUneable - ? (bottomBtnisEable - ? onClick - : () { - logic.showToast("请在锁旁边完成第一次开锁".tr); - }) - : null, + onTap: bottomBtnisEable + ? onClick + : () { + logic.showToast("请在锁旁边完成第一次开锁".tr); + }, child: child, ); } @@ -1290,6 +1265,7 @@ class _LockDetailPageState extends State left: 155.w, child: GestureDetector( onTap: () { + state.closedUnlockSuccessfulTimer?.cancel(); setState(() { state.iSClosedUnlockSuccessfulPopup.value = false; }); @@ -1345,7 +1321,7 @@ class _LockDetailPageState extends State state.iSOpenLock.value = true; state.iSClosedUnlockSuccessfulPopup.value = false; state.openLockBtnState.value = 1; - // state.animationController!.forward(); + state.animationController!.forward(); AppLog.log("点击开锁"); if (state.isOpenLockNeedOnline.value == 0) { @@ -1370,6 +1346,7 @@ class _LockDetailPageState extends State state.openLockBtnState.value = 1; state.animationController!.forward(); + EasyLoading.showToast("正在尝试闭锁……".tr, duration: 2000.milliseconds); AppLog.log("长按闭锁"); if (state.isOpenLockNeedOnline.value == 0) { // 不需要联网 diff --git a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart index ffe61bb0..fce968ef 100644 --- a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart +++ b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart @@ -38,7 +38,7 @@ class LockOperatingRecordLogic extends BaseGetXController { case 0x00: //成功 int dataLength = (reply.data[5] << 8) + reply.data[6]; - // AppLog.log("dataLength:$dataLength"); + AppLog.log("dataLength:$dataLength"); // var dataLength = reply.data[5]; if (dataLength > 0) { reply.data.removeRange(0, 7); @@ -186,10 +186,12 @@ class LockOperatingRecordLogic extends BaseGetXController { //清空操作记录 void clearOperationRecordRequest() async { - KeyOperationRecordEntity entity = - await ApiRepository.to.clearOperationRecord('28'); + KeyOperationRecordEntity entity = await ApiRepository.to.clearOperationRecord(CommonDataManage().currentKeyInfo.lockId.toString()); if (entity.errorCode!.codeIsSuccessful) { - showToast("清除数据成功"); + showToast("清除数据成功", something: (){ + pageNo = 1; + mockNetworkDataRequest(); + }); } } diff --git a/star_lock/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart b/star_lock/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart index 09766bcd..dbe2e746 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockEscalation/lockEscalation_logic.dart @@ -69,7 +69,7 @@ class LockEscalationLogic extends BaseGetXController { } String md5Str = md5.convert(otaBin!).toString(); headJson!['fwMd5'] = md5Str; - ShowTipView().showIosTipWithContentDialog("升级过程中无法开锁,请先开锁后再升级".tr, + ShowTipView().showIosTipWithContentDialog("未避免异常情况,请在门打开时升级".tr, () async { blueOTAUpgrade(headJson!, [0, 0, 0, 0]); EasyLoading.show( diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart index eea0b79f..e8a1f27f 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart @@ -113,7 +113,7 @@ class _PasswordKeyDetailPageState extends State } })), Obx(() => Visibility( - visible: state.isCirculation.value, + visible: state.isCirculation.value == false, child: CommonItem( leftTitel: "结束时间", rightTitle: DateTool().dateToYMDHNString( @@ -157,6 +157,10 @@ class _PasswordKeyDetailPageState extends State 'id': state.itemData.value.keyboardPwdId.toString() }); }), + Visibility( + visible: state.itemData.value.isCustom == 0 && state.itemData.value.keyboardPwdType != 1 && state.itemData.value.keyboardPwdType != 4, + child:bottomTip() + ), Container(height: 40.h), SizedBox( width: ScreenUtil().screenWidth - 40.w, @@ -243,6 +247,27 @@ class _PasswordKeyDetailPageState extends State )); } + Widget bottomTip(){ + return Column( + children: [ + Container( + padding: EdgeInsets.all(20.w), + child: Row( + // crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + "密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。".tr, + textAlign: TextAlign.start, + style: TextStyle(fontSize: 20.sp), + )), + ], + ), + ), + ], + ); + } + // 是否为管理员 CupertinoSwitch _isAdmin() { return CupertinoSwitch( diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart index 326a0b63..4762fd04 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart @@ -272,7 +272,7 @@ class PasswordKeyListLogic extends BaseGetXController { switch (getPwdType) { case 1: //单次 1 只能在开始时间后6小时内使用一次 - useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}'; + useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}'; break; case 2: //永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效 @@ -285,7 +285,7 @@ class PasswordKeyListLogic extends BaseGetXController { break; case 4: //删除 4 在锁上使用后会删除之前在锁上使用过的密码 - useDateStr = '${endDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}'; + useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}'; break; case 5: //周未循环 5 在周未开始和结束时间指定时间段内有效 diff --git a/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart b/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart index abdc428b..b6e1132d 100644 --- a/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart +++ b/star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart @@ -78,7 +78,7 @@ class NearbyLockLogic extends BaseGetXController { } // 获取锁状态信息 - if (reply is GetStarLockStatuInfoReply) { + if (reply is GetStarLockStatuInfoReply && state.ifCurrentScreen.value) { _replyGetStarLockStatusInfo(reply); } diff --git a/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart b/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart index e25a940f..ffc6f277 100644 --- a/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart +++ b/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart @@ -233,7 +233,7 @@ class SaveLockLogic extends BaseGetXController { userID: await Storage.getUid(), openMode: 1, keyType: 1, - startDate: DateTime.now().millisecondsSinceEpoch, + startDate: DateTime.now().millisecondsSinceEpoch ~/ 1000, expireDate: 0x11223344, useCountLimit: 0xFFFF, isRound: 0, diff --git a/star_lock/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart b/star_lock/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart index bf4240ee..dc737ec3 100644 --- a/star_lock/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart +++ b/star_lock/lib/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator/addAuthorizedAdministrator_page.dart @@ -67,8 +67,9 @@ class _AddAuthorizedAdministratorPageState : state.lockIdList.value.length.toString(), isHaveDirection: true, action: () { - Navigator.pushNamed(context, Routers.massSendLockGroupPage) - .then((value) { + Navigator.pushNamed(context, Routers.massSendLockGroupListPage, arguments: { + "keyLimits":"1" + }).then((value) { //得到选中的锁ID列表 if (value != null) { value as Map; @@ -109,8 +110,9 @@ class _AddAuthorizedAdministratorPageState : state.lockIdList.value.length.toString(), isHaveDirection: true, action: () { - Navigator.pushNamed(context, Routers.massSendLockGroupPage) - .then((value) { + Navigator.pushNamed(context, Routers.massSendLockGroupListPage,arguments:{ + "keyLimits":"1", + }).then((value) { //得到选中的锁ID列表 if (value != null) { value as Map; diff --git a/star_lock/lib/network/api_provider_base.dart b/star_lock/lib/network/api_provider_base.dart index de87b124..aebb0e7a 100644 --- a/star_lock/lib/network/api_provider_base.dart +++ b/star_lock/lib/network/api_provider_base.dart @@ -35,9 +35,9 @@ class BaseProvider extends GetConnect with Api { bool? isUnShowLoading = false, // 是否显示loading bool? isUserBaseUrl = true, // 文件上传不使用baseUrl }) async { - AppLog.log("post: url:$url body:$body contentType:$contentType"); + AppLog.log("post: url:$url body:$body"); if (isUnShowLoading == false){ - AppLog.log("post: url:$url show loading"); + // AppLog.log("post: url:$url show loading"); EasyLoading.show(); } if (isUserBaseUrl == false) { diff --git a/star_lock/lib/tools/baseGetXController.dart b/star_lock/lib/tools/baseGetXController.dart index 29de5361..af626b74 100644 --- a/star_lock/lib/tools/baseGetXController.dart +++ b/star_lock/lib/tools/baseGetXController.dart @@ -56,14 +56,17 @@ class BaseGetXController extends GetxController { void showEasyLoading() => EasyLoading.show(); void dismissEasyLoading() { - if(EasyLoading.isShow) EasyLoading.dismiss(); + if (EasyLoading.isShow) EasyLoading.dismiss(); } - void showTitleEasyLoading(String showContent) => EasyLoading.show(status: showContent); + void showTitleEasyLoading(String showContent) => + EasyLoading.show(status: showContent); Timer? _timer; + // CancelableOperation? _operation; - void showBlueConnetctToastTimer({bool isShowBlueConnetctToast = true, Function? action}) { + void showBlueConnetctToastTimer( + {bool isShowBlueConnetctToast = true, Function? action}) { if (_timer != null && _timer!.isActive) { _timer!.cancel(); _timer = null; @@ -88,9 +91,9 @@ class BaseGetXController extends GetxController { } void showBlueConnetctToast() { - bool isContains = BlueManage().connectDeviceName!.contains("T9A"); + bool isContains = BlueManage().connectDeviceName.contains("T9A"); showToast( - "连接设备失败,请确保在设备附近,设备未被连接,设备已打开${isContains == true ? "。如果是全自动锁,请使屏幕变亮" : ""}"); + "${'操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。'.tr}${isContains == true ? "如果是全自动锁,请使屏幕变亮" : ""}"); } void showToast(String status, {Function? something}) { @@ -116,6 +119,7 @@ class BaseGetXController extends GetxController { void showOperationSuccessful({String? status, Function? something}) => showSuccess(status ?? "成功", something: something); + void showOperationFailed({String? status, Function? something}) => showError(status ?? "失败", something: something); @@ -171,7 +175,8 @@ class BaseGetXController extends GetxController { String useDateStr = ''; if (keyType == XSConstantMacro.keyTypeTime) { //限期 - useDateStr = "${DateTool().dateToYMDHNString(startDate.toString())}-${DateTool().dateToYMDHNString(endDate.toString())} ${"限时".tr}"; + useDateStr = + "${DateTool().dateToYMDHNString(startDate.toString())}-${DateTool().dateToYMDHNString(endDate.toString())} ${"限时".tr}"; } else if (keyType == XSConstantMacro.keyTypeLong) { //永久 // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); @@ -184,7 +189,8 @@ class BaseGetXController extends GetxController { useDateStr = '单次'.tr; } else if (keyType == XSConstantMacro.keyTypeLoop) { //循环 - useDateStr = "${DateTool().dateToYMDString(startDate.toString())}-${DateTool().dateToYMDString(endDate.toString())} ${"循环".tr}"; + useDateStr = + "${DateTool().dateToYMDString(startDate.toString())}-${DateTool().dateToYMDString(endDate.toString())} ${"循环".tr}"; } return useDateStr; @@ -214,5 +220,6 @@ class BaseGetXController extends GetxController { ///Extension_Int extension Extension_Int on int { bool get codeIsSuccessful => this == 0; + bool get msgCodeIsSuccessful => this == 1; } diff --git a/star_lock/lib/widget/permission/permission_dialog.dart b/star_lock/lib/widget/permission/permission_dialog.dart index dabaa3df..acaf315b 100644 --- a/star_lock/lib/widget/permission/permission_dialog.dart +++ b/star_lock/lib/widget/permission/permission_dialog.dart @@ -32,14 +32,30 @@ class PermissionDialog { return false; } bool application = true; - Map statuses = await [ + List permissions = [ + Permission.bluetooth, Permission.bluetoothScan, Permission.bluetoothConnect, - ].request(); + ]; + Future getPermissionStatus(List permissions) async { + bool isGranted = true; + List permissionStatus = []; + for (Permission per in permissions) { + permissionStatus.add(await per.status); + } + for (PermissionStatus per in permissionStatus) { + isGranted = isGranted && per.isGranted; + } + if (GetPlatform.isIOS) { + isGranted = permissionStatus[0].isGranted; + } + return isGranted; + } + Permission permission = Permission.bluetoothScan; dynamic cache = await Storage.getString(titles[permission]); - bool isGranted = statuses.values.every((element) => element.isGranted); - if (AppPlatform.isAndroid && !isGranted && cache is! String) { + bool isGranted = await getPermissionStatus(permissions); + if (GetPlatform.isAndroid && !isGranted && cache is! String) { application = await showCupertinoDialog( context: Get.context!, builder: (context) { @@ -69,16 +85,19 @@ class PermissionDialog { if (application) { await Storage.setString(titles[permission], titles[permission]); } - } else if (cache is String) { - bool isDenied = statuses.values.every((element) => element.isDenied); - if (isDenied) { + } else if (cache is! String) { + await Storage.setString(titles[permission], titles[permission]); + } else { + bool isGranted = await getPermissionStatus(permissions); + if (!isGranted) { showSet(permission); return false; } } if (application) { - PermissionStatus status = await permission.request(); - return status.isGranted; + await permissions.request(); + bool isGranted = await getPermissionStatus(permissions); + return isGranted; } return false; } diff --git a/star_lock/pubspec.yaml b/star_lock/pubspec.yaml index 9c25ad60..0e6edc46 100644 --- a/star_lock/pubspec.yaml +++ b/star_lock/pubspec.yaml @@ -42,8 +42,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 1.0.32+2024051001:打包给欧阳回归测试 # 1.0.33+2024051401:打包给欧阳回归测试 # 1.0.34+2024051402:打包给欧阳回归测试 +# 1.0.35+2024051501:打包给欧阳回归测试 -version: 1.0.34+2024051402 +version: 1.0.35+2024051501 environment: sdk: '>=2.12.0 <3.0.0' @@ -178,6 +179,10 @@ dependencies: file_picker: ^5.3.1 +dependency_overrides: + #强制设置google_maps_flutter_ios 为 2.5.2 + google_maps_flutter_ios: 2.5.2 + dev_dependencies: flutter_test: sdk: flutter