bug
This commit is contained in:
parent
31e49d218e
commit
dab98aef62
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -51,12 +51,12 @@ class _ValueAddedServicesPageListState
|
||||
Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage,
|
||||
arguments: <String, int>{'type': 1});
|
||||
}),
|
||||
_valueAddedServicesItem(
|
||||
Image.asset('images/mine/icon_mine_valueAddedServices_email.png'),
|
||||
'邮件'.tr, () {
|
||||
Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage,
|
||||
arguments: <String, int>{'type': 2});
|
||||
}),
|
||||
// _valueAddedServicesItem(
|
||||
// Image.asset('images/mine/icon_mine_valueAddedServices_email.png'),
|
||||
// '邮件'.tr, () {
|
||||
// Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage,
|
||||
// arguments: <String, int>{'type': 2});
|
||||
// }),
|
||||
_valueAddedServicesItem(
|
||||
Image.asset(
|
||||
'images/mine/icon_mine_valueAddedServices_realName.png'),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user