diff --git a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index 268bb6d9..ed4dd52e 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -88,7 +88,10 @@ class LockDetailLogic extends BaseGetXController { state.electricQuantityStandby.value = powerStandby; } // 更新电量 - uploadElectricQuantityRequest(); + await uploadElectricQuantityRequest(); + + // 开锁成功上报 + lockReportLockSuccessfullyUploadData(); //锁数据更新 // getLockRecordLastUploadDataTime(); resetOpenDoorState(); @@ -491,6 +494,22 @@ class LockDetailLogic extends BaseGetXController { } } + // 电子钥匙开锁成功上报 + Future lockReportLockSuccessfullyUploadData() async { + final KeyOperationRecordEntity entity = await ApiRepository.to.lockReportLockSuccessfullyUploadData( + lockId: state.keyInfos.value.lockId ?? 0, + keyId: state.keyInfos.value.keyId ?? 0 + ); + if (entity.errorCode!.codeIsSuccessful) { + // mockNetworkDataRequest(); + AppLog.log('state.keyInfos.value.keyType:${state.keyInfos.value.keyType}'); + if (state.keyInfos.value.keyType == XSConstantMacro.keyTypeOnce) { + // 单次删除 + deletKeyData(); + } + } + } + // 普通用户或者授权管理员删除钥匙 Future deletKeyData() async { final ElectronicKeyListEntity entity = await ApiRepository.to diff --git a/lib/network/api_provider.dart b/lib/network/api_provider.dart index 8499afa5..f6bc9df6 100755 --- a/lib/network/api_provider.dart +++ b/lib/network/api_provider.dart @@ -339,6 +339,15 @@ class ApiProvider extends BaseProvider { isShowErrMsg: false, ); + // 锁记录上传 + Future lockReportLockSuccessfullyUploadData(int lockId, int keyId) => post( + lockRecordUploadURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'keyId': keyId, + }), + isUnShowLoading: true); + // 获取手机联网token Future getLockNetToken(String lockId) => post( getLockNetTokenURL.toUrl, diff --git a/lib/network/api_repository.dart b/lib/network/api_repository.dart index d41935dd..ee5e211c 100755 --- a/lib/network/api_repository.dart +++ b/lib/network/api_repository.dart @@ -308,6 +308,13 @@ class ApiRepository { return LockOperatingRecordGetLastRecordTimeEntity.fromJson(res.body); } + // 电子钥匙开锁成功上报 + Future lockReportLockSuccessfullyUploadData( + {required int lockId, required int keyId}) async { + final res = await apiProvider.lockReportLockSuccessfullyUploadData(lockId, keyId); + return KeyOperationRecordEntity.fromJson(res.body); + } + // 获取手机联网token Future getLockNetToken({required String lockId}) async { final res = await apiProvider.getLockNetToken(lockId); diff --git a/pre_build.sh b/pre_build.sh old mode 100644 new mode 100755 diff --git a/pubspec.yaml b/pubspec.yaml index f36ec4e2..f2a66206 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -78,7 +78,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 1.0.69+2024070301:xhj 线上环境,提交测试:周常 bug 修复 # 1.0.69+2024070302:xhj 线上环境,提交测试:周常 bug 修复 -version: 1.0.69+2024070302 +version: 1.0.70+2024072401 environment: sdk: '>=2.12.0 <3.0.0'