bug
This commit is contained in:
parent
31e49d218e
commit
dab98aef62
@ -696,55 +696,53 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
showToast('猫眼设置为省电模式时无法进行远程开锁,请在猫眼设置中切换为其他模式'.tr);
|
showToast('猫眼设置为省电模式时无法进行远程开锁,请在猫眼设置中切换为其他模式'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final LockListInfoItemEntity currentKeyInfo = CommonDataManage().currentKeyInfo;
|
|
||||||
var lockId = currentKeyInfo.lockId ?? 0;
|
|
||||||
var remoteUnlock = currentKeyInfo.lockSetting?.remoteUnlock ?? 0;
|
|
||||||
|
|
||||||
// 每次远程开锁都使用当前锁的peerId,确保使用正确的锁
|
// 发送远程开锁API
|
||||||
final network = currentKeyInfo.network;
|
final LoginEntity entity = await ApiRepository.to.remoteOpenLock(
|
||||||
var lockPeerId = '';
|
lockId: state.keyInfos.value.lockId.toString(),
|
||||||
if (network != null && network.peerId != null && network.peerId!.isNotEmpty) {
|
timeOut: 60,
|
||||||
lockPeerId = network.peerId!;
|
);
|
||||||
StartChartManage().lockPeerId = lockPeerId;
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
AppLog.log('已开锁'.tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remoteUnlock == 1) {
|
// 网关锁
|
||||||
try {
|
if (state.keyInfos.value.hasGateway == 1){
|
||||||
if (lockPeerId.isEmpty) {
|
// 发送远程开锁API
|
||||||
AppLog.log('远程服务未连接,无法进行远程开锁');
|
final LoginEntity entity = await ApiRepository.to.remoteOpenLock(
|
||||||
return;
|
lockId: state.keyInfos.value.lockId.toString(),
|
||||||
}
|
timeOut: 60,
|
||||||
|
);
|
||||||
final response = await StartChartApi.to.analyzeInformationOtherEnd(peerId: lockPeerId);
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if (response.statusCode == 200) {
|
showToast('已开锁'.tr);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
} 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,
|
Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage,
|
||||||
arguments: <String, int>{'type': 1});
|
arguments: <String, int>{'type': 1});
|
||||||
}),
|
}),
|
||||||
_valueAddedServicesItem(
|
// _valueAddedServicesItem(
|
||||||
Image.asset('images/mine/icon_mine_valueAddedServices_email.png'),
|
// Image.asset('images/mine/icon_mine_valueAddedServices_email.png'),
|
||||||
'邮件'.tr, () {
|
// '邮件'.tr, () {
|
||||||
Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage,
|
// Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage,
|
||||||
arguments: <String, int>{'type': 2});
|
// arguments: <String, int>{'type': 2});
|
||||||
}),
|
// }),
|
||||||
_valueAddedServicesItem(
|
_valueAddedServicesItem(
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'images/mine/icon_mine_valueAddedServices_realName.png'),
|
'images/mine/icon_mine_valueAddedServices_realName.png'),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user