57 lines
1.6 KiB
Dart
57 lines
1.6 KiB
Dart
|
|
import 'package:star_lock/tools/baseGetXController.dart';
|
|
|
|
import '../../../login/login/entity/LoginEntity.dart';
|
|
import '../../../network/api_repository.dart';
|
|
import '../../mineSet/transferGateway/selectGetewayList_entity.dart';
|
|
import 'gatewayList_state.dart';
|
|
|
|
class GatewayListLogic extends BaseGetXController {
|
|
GatewayListState state = GatewayListState();
|
|
|
|
// 获取网关列表
|
|
Future<GetewayDataEntity> getGatewayListData(
|
|
{required bool isRefresh}) async {
|
|
// 如果是下拉刷新,清空已有数据
|
|
if (isRefresh) {
|
|
state.getewayListData.clear();
|
|
pageNo = 1;
|
|
}
|
|
final GetewayDataEntity entity = await ApiRepository.to.getGatewayListData(
|
|
pageNo: pageNo.toString(),
|
|
pageSize: pageSize,
|
|
);
|
|
if (entity.errorCode!.codeIsSuccessful) {
|
|
// 更新数据列表
|
|
state.getewayListData.addAll(entity.data!.list!);
|
|
// 更新页码
|
|
pageNo++;
|
|
}
|
|
return entity;
|
|
}
|
|
|
|
// 测试配网成功
|
|
// Future<void> gatewayDistributionNetwork() async{
|
|
// final LoginEntity entity = await ApiRepository.to.gatewayDistributionNetwork(
|
|
// gatewayName: '测试网关添加',
|
|
// gatewayMac: '48:6F:73:52:A1:C3',
|
|
// serialNumber: '1.0.0',
|
|
// gatewayType: 2,
|
|
// networkName: '测试网关添加WiFi名字',
|
|
// networkMac: '48:6F:73:52:A1:C3',
|
|
// version: '1.0.0',
|
|
// );
|
|
// if(entity.errorCode!.codeIsSuccessful){
|
|
// showToast('配网成功', something:(){
|
|
//
|
|
// });
|
|
// }
|
|
// }
|
|
|
|
// @override
|
|
// void onInit() {
|
|
// super.onInit();
|
|
// gatewayDistributionNetwork();
|
|
// }
|
|
|
|
} |