From dab98aef620b7ee50dafadc8e3d4c308b97c1593 Mon Sep 17 00:00:00 2001 From: sky_min Date: Sat, 13 Dec 2025 16:18:00 +0800 Subject: [PATCH] bug --- .../lockDetail/lockDetail_logic.dart | 88 +++++++++---------- .../valueAddedServicesList_page.dart | 12 +-- 2 files changed, 49 insertions(+), 51 deletions(-) diff --git a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index c7019c9e..ad912dc2 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -696,55 +696,53 @@ class LockDetailLogic extends BaseGetXController { showToast('猫眼设置为省电模式时无法进行远程开锁,请在猫眼设置中切换为其他模式'.tr); return; } - final LockListInfoItemEntity currentKeyInfo = CommonDataManage().currentKeyInfo; - var lockId = currentKeyInfo.lockId ?? 0; - var remoteUnlock = currentKeyInfo.lockSetting?.remoteUnlock ?? 0; - // 每次远程开锁都使用当前锁的peerId,确保使用正确的锁 - final network = currentKeyInfo.network; - var lockPeerId = ''; - if (network != null && network.peerId != null && network.peerId!.isNotEmpty) { - lockPeerId = network.peerId!; - StartChartManage().lockPeerId = lockPeerId; + // 发送远程开锁API + final LoginEntity entity = await ApiRepository.to.remoteOpenLock( + lockId: state.keyInfos.value.lockId.toString(), + timeOut: 60, + ); + if (entity.errorCode!.codeIsSuccessful) { + AppLog.log('已开锁'.tr); } - if (remoteUnlock == 1) { - try { - if (lockPeerId.isEmpty) { - AppLog.log('远程服务未连接,无法进行远程开锁'); - return; - } - - final response = await StartChartApi.to.analyzeInformationOtherEnd(peerId: lockPeerId); - if (response.statusCode == 200) { - AppLog.log('成功分析对端信息'); - } else { - AppLog.log('分析对端信息失败,状态码: ${response.statusCode}'); - return; - } - - // WiFi锁 - final network = currentKeyInfo.network; - if (network != null && (network.peerId != null && network.peerId!.isNotEmpty)){ - // 发送蓝牙透传开锁指令 - await _sendUnlockViaBluetooth(); - } - // 网关锁 - if (state.keyInfos.value.hasGateway == 1) { - // 发送远程开锁API - final LoginEntity entity = await ApiRepository.to.remoteOpenLock(lockId: lockId.toString(), timeOut: 60); - if (entity.errorCode!.codeIsSuccessful) { - showToast('已开锁'.tr); - StartChartManage().lockListPeerId = []; - } - } - } catch (e) { - AppLog.log('远程开锁失败: $e'); - showToast('远程开锁失败'.tr); + // 网关锁 + if (state.keyInfos.value.hasGateway == 1){ + // 发送远程开锁API + final LoginEntity entity = await ApiRepository.to.remoteOpenLock( + lockId: state.keyInfos.value.lockId.toString(), + timeOut: 60, + ); + if (entity.errorCode!.codeIsSuccessful) { + showToast('已开锁'.tr); } - } else { - AppLog.log('该锁的远程开锁功能未启用'); - showToast('该锁的远程开锁功能未启用'.tr); + } + + // WiFi锁 + final LockListInfoItemEntity currentKeyInfo = CommonDataManage().currentKeyInfo; + final network = currentKeyInfo.network; + if (network != null && (network.peerId != null && network.peerId!.isNotEmpty)){ + final network = currentKeyInfo.network; + var lockPeerId = ''; + if (network != null && network.peerId != null && network.peerId!.isNotEmpty) { + lockPeerId = network.peerId!; + StartChartManage().lockPeerId = lockPeerId; + } + + if (lockPeerId.isEmpty) { + AppLog.log('远程服务未连接,无法进行远程开锁'); + return; + } + + final response = await StartChartApi.to.analyzeInformationOtherEnd(peerId: lockPeerId); + if (response.statusCode == 200) { + AppLog.log('成功分析对端信息'); + } else { + AppLog.log('分析对端信息失败,状态码: ${response.statusCode}'); + return; + } + // 发送蓝牙透传开锁指令 + await _sendUnlockViaBluetooth(); } } diff --git a/lib/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart b/lib/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart index 52a21ea9..a35b2a0c 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_page.dart @@ -51,12 +51,12 @@ class _ValueAddedServicesPageListState Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage, arguments: {'type': 1}); }), - _valueAddedServicesItem( - Image.asset('images/mine/icon_mine_valueAddedServices_email.png'), - '邮件'.tr, () { - Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage, - arguments: {'type': 2}); - }), + // _valueAddedServicesItem( + // Image.asset('images/mine/icon_mine_valueAddedServices_email.png'), + // '邮件'.tr, () { + // Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage, + // arguments: {'type': 2}); + // }), _valueAddedServicesItem( Image.asset( 'images/mine/icon_mine_valueAddedServices_realName.png'),