添加电子钥匙开锁成功上报功能

This commit is contained in:
魏少阳 2024-07-24 10:12:36 +08:00
parent e34841ad87
commit caac5f2a55
5 changed files with 37 additions and 2 deletions

View File

@ -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<void> 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<void> deletKeyData() async {
final ElectronicKeyListEntity entity = await ApiRepository.to

View File

@ -339,6 +339,15 @@ class ApiProvider extends BaseProvider {
isShowErrMsg: false,
);
//
Future<Response> lockReportLockSuccessfullyUploadData(int lockId, int keyId) => post(
lockRecordUploadURL.toUrl,
jsonEncode({
'lockId': lockId,
'keyId': keyId,
}),
isUnShowLoading: true);
// token
Future<Response> getLockNetToken(String lockId) => post(
getLockNetTokenURL.toUrl,

View File

@ -308,6 +308,13 @@ class ApiRepository {
return LockOperatingRecordGetLastRecordTimeEntity.fromJson(res.body);
}
//
Future<KeyOperationRecordEntity> lockReportLockSuccessfullyUploadData(
{required int lockId, required int keyId}) async {
final res = await apiProvider.lockReportLockSuccessfullyUploadData(lockId, keyId);
return KeyOperationRecordEntity.fromJson(res.body);
}
// token
Future<LockNetTokenEntity> getLockNetToken({required String lockId}) async {
final res = await apiProvider.getLockNetToken(lockId);

0
pre_build.sh Normal file → Executable file
View File

View File

@ -78,7 +78,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# 1.0.69+2024070301xhj 线上环境,提交测试:周常 bug 修复
# 1.0.69+2024070302xhj 线上环境,提交测试:周常 bug 修复
version: 1.0.69+2024070302
version: 1.0.70+2024072401
environment:
sdk: '>=2.12.0 <3.0.0'