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