57 lines
1.7 KiB
Dart
Executable File
57 lines
1.7 KiB
Dart
Executable File
import 'package:get/get.dart';
|
|
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
|
|
|
|
import '../../../network/api_repository.dart';
|
|
import '../../../tools/baseGetXController.dart';
|
|
import 'appUnlockNeedMobileNetworkingLock_state.dart';
|
|
import 'selectLockListEntity.dart';
|
|
|
|
class AppUnlockNeedMobileNetworkingLockLogic extends BaseGetXController {
|
|
final AppUnlockNeedMobileNetworkingLockState state =
|
|
AppUnlockNeedMobileNetworkingLockState();
|
|
|
|
//请求锁列表
|
|
Future<SelectLockListEntity> mockNetworkDataRequest() async {
|
|
final SelectLockListEntity entity = await ApiRepository.to
|
|
.selectLockList(searchStr: state.searchController.text);
|
|
List<LockItemData> dataList = <LockItemData>[];
|
|
if (entity.errorCode!.codeIsSuccessful) {
|
|
dataList = entity.data!.list!;
|
|
state.lockItemList.value = dataList;
|
|
for (int i = 0; i < dataList.length; i++) {
|
|
final LockItemData itemData = dataList[i];
|
|
if (itemData.appUnlockOnline == 1) {
|
|
state.selectLockIdList.add(itemData.lockId);
|
|
}
|
|
}
|
|
}
|
|
return entity;
|
|
}
|
|
|
|
//APP开锁时需手机联网的锁
|
|
Future<void> setAppUnlockMustOnlineRequest() async {
|
|
final SelectLockListEntity entity =
|
|
await ApiRepository.to.setAppUnlockMustOnline(state.selectLockIdList);
|
|
if (entity.errorCode!.codeIsSuccessful) {
|
|
showToast('操作成功'.tr);
|
|
|
|
//刷新锁列表,更新锁详情--手机需联网标识
|
|
if (Get.isRegistered<LockMainLogic>()) {
|
|
Get.find<LockMainLogic>().getStarLockInfo(isUnShowLoading: true);
|
|
}
|
|
}
|
|
}
|
|
|
|
@override
|
|
void onReady() {
|
|
super.onReady();
|
|
|
|
// mockNetworkDataRequest();
|
|
}
|
|
|
|
@override
|
|
void onInit() {
|
|
super.onInit();
|
|
}
|
|
}
|