feat:调整读取记录时一直转圈的问题

This commit is contained in:
liyi 2025-03-12 17:31:54 +08:00
parent 2fb3c7d2b5
commit 794bf8cf11

View File

@ -54,9 +54,11 @@ class DoorLockLogLogic extends BaseGetXController {
switch (status) {
case 0x00:
dismissEasyLoading();
cancelBlueConnetctToastTimer();
//
final 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);
@ -108,6 +110,8 @@ class DoorLockLogLogic extends BaseGetXController {
state.ifHaveNext = false;
}
lockRecordUploadData(uploadList);
} else {
showToast('暂无最新记录'.tr);
}
break;
case 0x06:
@ -117,6 +121,7 @@ class DoorLockLogLogic extends BaseGetXController {
default:
//
dismissEasyLoading();
cancelBlueConnetctToastTimer();
break;
}
}
@ -148,30 +153,23 @@ class DoorLockLogLogic extends BaseGetXController {
).toString();
showEasyLoading();
showBlueConnetctToastTimer(
isShowBlueConnetctToast: true,
action: () async {
cancelBlueConnetctToastTimer();
showBlueConnetctToastTimer(action: () async {
dismissEasyLoading();
final String getMobile = (await Storage.getMobile())!;
ApmHelper.instance.trackEvent('check_doorLockLog', {
'lockName': state.keyInfos.value.lockName!,
'account':
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
'date': DateTool().getNowDateWithType(1),
'open_lock_result': '超时',
});
final String getMobile = (await Storage.getMobile())!;
ApmHelper.instance.trackEvent('check_doorLockLog', {
'lockName': state.keyInfos.value.lockName!,
'account':
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
'date': DateTool().getNowDateWithType(1),
'open_lock_result': '超时',
});
BuglyTool.uploadException(
message: '查询锁记录超时-查询锁记录失败',
detail:
'添加密码超时,查询锁记录失败--senderReferEventRecordTimeCommand:$command',
eventStr: '查询锁记录事件超时',
upload: true);
if (state.isLockReceiveResponse == false) {
dismissEasyLoading();
}
});
BuglyTool.uploadException(
message: '查询锁记录超时-查询锁记录失败',
detail: '添加密码超时,查询锁记录失败--senderReferEventRecordTimeCommand:$command',
eventStr: '查询锁记录事件超时',
upload: true);
});
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionStateState) async {
if (connectionStateState == BluetoothConnectionState.connected) {
@ -303,20 +301,22 @@ class DoorLockLogLogic extends BaseGetXController {
lockId: state.keyInfos.value.lockId.toString(), records: list);
final String getMobile = (await Storage.getMobile())!;
if (entity.errorCode!.codeIsSuccessful) {
if (state.ifHaveNext == true) {
showEasyLoading();
getLockRecordLastUploadDataTime();
} else {
ApmHelper.instance.trackEvent('check_doorLockLog', {
'lockName': state.keyInfos.value.lockName!,
'account':
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
'date': DateTool().getNowDateWithType(1),
'open_lock_result': '成功',
});
mockNetworkDataRequest(isRefresh: true);
}
dismissEasyLoading();
showToast('操作成功'.tr, something: () async {
dismissEasyLoading();
if (state.ifHaveNext == true) {
showEasyLoading();
getLockRecordLastUploadDataTime();
} else {
ApmHelper.instance.trackEvent('check_doorLockLog', {
'lockName': state.keyInfos.value.lockName!,
'account':
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
'date': DateTool().getNowDateWithType(1),
'open_lock_result': '成功',
});
mockNetworkDataRequest(isRefresh: true);
}
});
} else {
ApmHelper.instance.trackEvent('check_doorLockLog', {
'lockName': state.keyInfos.value.lockName!,