diff --git a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index 6a0cde09..291d88cd 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -707,34 +707,34 @@ class LockDetailLogic extends BaseGetXController { if (entity.errorCode!.codeIsSuccessful) { showToast('已开锁'.tr); } - } + } else { + // WiFi锁 + final LockListInfoItemEntity currentKeyInfo = CommonDataManage().currentKeyInfo; + final network = currentKeyInfo.network; + if (network != null && (network.peerId != null && network.peerId != '' && network.peerId!.isNotEmpty)){ + final network = currentKeyInfo.network; + var lockPeerId = ''; + if (network != null && network.peerId != null && network.peerId!.isNotEmpty) { + lockPeerId = network.peerId!; + StartChartManage().lockPeerId = lockPeerId; + } - // 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; + } - 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(); + } } - - 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/network/api_provider_base.dart b/lib/network/api_provider_base.dart index 951905d4..be8d0fdf 100755 --- a/lib/network/api_provider_base.dart +++ b/lib/network/api_provider_base.dart @@ -61,7 +61,7 @@ class BaseProvider extends GetConnect with Api { if (res.body == null) { // EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); if (res.statusCode == null && isShowErrMsg!) { - EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 2000.milliseconds); + EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 6000.milliseconds); // EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); } var rs = {'errorMsg': 'Network Error!', 'errorCode': -1, 'data': null, 'description': '表示成功或是。'};