fix: 1、修改网关模块、远程开锁超时时间为60秒
This commit is contained in:
parent
ff1932689a
commit
ddf590c321
@ -606,8 +606,8 @@ class LockDetailLogic extends BaseGetXController {
|
||||
|
||||
// 远程开锁
|
||||
Future<void> remoteOpenLock() async {
|
||||
final LoginEntity entity = await ApiRepository.to
|
||||
.remoteOpenLock(lockId: state.keyInfos.value.lockId.toString());
|
||||
final LoginEntity entity = await ApiRepository.to.remoteOpenLock(
|
||||
lockId: state.keyInfos.value.lockId.toString(), timeOut: 60);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast('已开锁'.tr);
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import 'flavors.dart';
|
||||
import 'main.dart' as runner;
|
||||
|
||||
Future<void> main() async {
|
||||
F.appFlavor = Flavor.xhj;
|
||||
F.appFlavor = Flavor.xhj_pre;
|
||||
// AppLog.log('local调用了main函数');
|
||||
await runner.main();
|
||||
}
|
||||
|
||||
@ -31,7 +31,8 @@ class GatewayConfigurationWifiLogic extends BaseGetXController {
|
||||
networkName: state.wifiNameTF.text,
|
||||
networkMac: state.gatewayModel.wifiMac,
|
||||
version: state.gatewayModel.gatewayVersion,
|
||||
gatewayJson: jsonDecode(state.gatewayJson));
|
||||
gatewayJson: jsonDecode(state.gatewayJson),
|
||||
timeout: 60);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast('配网成功'.tr, something: () {
|
||||
// eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
@ -42,7 +43,7 @@ class GatewayConfigurationWifiLogic extends BaseGetXController {
|
||||
|
||||
Future<void> getGatewayConfiguration() async {
|
||||
final GetGatewayConfigurationEntity entity =
|
||||
await ApiRepository.to.getGatewayConfiguration();
|
||||
await ApiRepository.to.getGatewayConfiguration(timeout: 60);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.getGatewayConfigurationStr = entity.data ?? '';
|
||||
// AppLog.log('state.getGatewayConfigurationStr:${state.getGatewayConfigurationStr}');
|
||||
|
||||
@ -3,7 +3,6 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/appRouteObserver.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
|
||||
@ -2,7 +2,6 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/io_gateway/io_gateway_configuringWifi.dart';
|
||||
import 'package:star_lock/blue/io_gateway/io_gateway_getWifiList.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
|
||||
@ -12,7 +12,8 @@ class GatewayConnectionLockListLogic extends BaseGetXController {
|
||||
Future<GatewayConnectionLockListEntity>
|
||||
gatewayConnectionLockListDataRequest() async {
|
||||
final GatewayConnectionLockListEntity entity = await ApiRepository.to
|
||||
.gatewayConnectionLockLoadData(gatewayId: state.gatewayId.value);
|
||||
.gatewayConnectionLockLoadData(
|
||||
gatewayId: state.gatewayId.value, timeout: 60);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.itemDataList.value = entity.data!.list!;
|
||||
}
|
||||
@ -21,7 +22,7 @@ class GatewayConnectionLockListLogic extends BaseGetXController {
|
||||
|
||||
Future<void> gatewayScanDevice() async {
|
||||
final LoginEntity entity = await ApiRepository.to
|
||||
.gatewayScanDevice(gatewayId: state.gatewayId.value);
|
||||
.gatewayScanDevice(gatewayId: state.gatewayId.value, timeout: 60);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
gatewayConnectionLockListDataRequest();
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ class _GatewayConnectionLockListPageState
|
||||
Obx(() => Expanded(
|
||||
child: state.itemDataList.value.isNotEmpty
|
||||
? ListView.builder(
|
||||
itemCount: 10,
|
||||
itemCount: state.itemDataList.value.length,
|
||||
itemBuilder: (BuildContext c, int index) {
|
||||
final GatewayConnectionLockItemEntity entity =
|
||||
state.itemDataList[index];
|
||||
|
||||
@ -12,7 +12,8 @@ class GatewayDetailLogic extends BaseGetXController {
|
||||
Future<void> deletGateway(int isForce) async {
|
||||
final LoginEntity entity = await ApiRepository.to.gatewayDelet(
|
||||
gatewayId: state.getewayItemData.value.gatewayId ?? 0,
|
||||
isForce: isForce);
|
||||
isForce: isForce,
|
||||
timeout: 60);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast('删除成功'.tr, something: () {
|
||||
// eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
@ -27,7 +28,8 @@ class GatewayDetailLogic extends BaseGetXController {
|
||||
Future<void> updateGateway(String gatewayName) async {
|
||||
final LoginEntity entity = await ApiRepository.to.gatewayUpdate(
|
||||
gatewayId: state.getewayItemData.value.gatewayId ?? 0,
|
||||
gatewayName: gatewayName);
|
||||
gatewayName: gatewayName,
|
||||
timeout: 60);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast('修改成功'.tr, something: () {
|
||||
// eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../login/login/entity/LoginEntity.dart';
|
||||
@ -18,9 +17,7 @@ class GatewayListLogic extends BaseGetXController {
|
||||
pageNo = 1;
|
||||
}
|
||||
final GetewayDataEntity entity = await ApiRepository.to.getGatewayListData(
|
||||
pageNo: pageNo.toString(),
|
||||
pageSize: pageSize,
|
||||
);
|
||||
pageNo: pageNo.toString(), pageSize: pageSize, timeout: 60);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
// 更新数据列表
|
||||
state.getewayListData.addAll(entity.data!.list!);
|
||||
@ -51,7 +48,6 @@ class GatewayListLogic extends BaseGetXController {
|
||||
// @override
|
||||
// void onInit() {
|
||||
// super.onInit();
|
||||
// gatewayDistributionNetwork();
|
||||
// gatewayDistributionNetwork();
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,20 +1,17 @@
|
||||
|
||||
import 'package:star_lock/mine/mineSet/transferGateway/selectGetewayList_entity.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../network/api_repository.dart';
|
||||
import 'selectGetewayList_state.dart';
|
||||
|
||||
class SelectGetewayListLogic extends BaseGetXController{
|
||||
class SelectGetewayListLogic extends BaseGetXController {
|
||||
SelectGetewayListState state = SelectGetewayListState();
|
||||
|
||||
// 获取锁列表
|
||||
Future<void> getGetewayListData() async{
|
||||
final GetewayDataEntity entity = await ApiRepository.to.getGatewayListData(
|
||||
pageNo: '1',
|
||||
pageSize: '20'
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
Future<void> getGetewayListData() async {
|
||||
final GetewayDataEntity entity = await ApiRepository.to
|
||||
.getGatewayListData(pageNo: '1', pageSize: '20', timeout: 60);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.getewayListData.value = entity.data!.list!;
|
||||
}
|
||||
}
|
||||
@ -25,5 +22,4 @@ class SelectGetewayListLogic extends BaseGetXController{
|
||||
|
||||
getGetewayListData();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1727,21 +1727,23 @@ class ApiProvider extends BaseProvider {
|
||||
}));
|
||||
|
||||
// 获取网关列表
|
||||
Future<Response> getGatewayListData(String pageNo, String pageSize) => post(
|
||||
gatewaykListURL.toUrl,
|
||||
jsonEncode({'pageNo': pageNo, 'pageSize': pageSize}));
|
||||
Future<Response> getGatewayListData(
|
||||
String pageNo, String pageSize, int timeout) =>
|
||||
post(gatewaykListURL.toUrl,
|
||||
jsonEncode({'pageNo': pageNo, 'pageSize': pageSize}),
|
||||
timeout: timeout);
|
||||
|
||||
// 添加网关
|
||||
Future<Response> addGatewayNetwork(
|
||||
String gatewayName,
|
||||
String gatewayMac,
|
||||
String serialNumber,
|
||||
int gatewayType,
|
||||
String networkName,
|
||||
String networkMac,
|
||||
String version,
|
||||
Map gatewayJson,
|
||||
) =>
|
||||
String gatewayName,
|
||||
String gatewayMac,
|
||||
String serialNumber,
|
||||
int gatewayType,
|
||||
String networkName,
|
||||
String networkMac,
|
||||
String version,
|
||||
Map gatewayJson,
|
||||
int timeout) =>
|
||||
post(
|
||||
addGatewayURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -1753,37 +1755,37 @@ class ApiProvider extends BaseProvider {
|
||||
'networkMac': networkMac,
|
||||
'version': version,
|
||||
'gatewayJson': gatewayJson,
|
||||
}));
|
||||
}),
|
||||
timeout: timeout);
|
||||
|
||||
// 删除网关
|
||||
Future<Response> deletGateway(int gatewayId, int isForce) => post(
|
||||
deletGatewayURL.toUrl,
|
||||
jsonEncode({
|
||||
'gatewayId': gatewayId,
|
||||
'isForce': isForce,
|
||||
}));
|
||||
Future<Response> deletGateway(int gatewayId, int isForce, int timeout) =>
|
||||
post(
|
||||
deletGatewayURL.toUrl,
|
||||
jsonEncode({
|
||||
'gatewayId': gatewayId,
|
||||
'isForce': isForce,
|
||||
}),
|
||||
timeout: timeout);
|
||||
|
||||
// 网关更新
|
||||
Future<Response> gatewayUpdate(
|
||||
int gatewayId,
|
||||
String gatewayName,
|
||||
) =>
|
||||
int gatewayId, String gatewayName, int timeout) =>
|
||||
post(
|
||||
updateGatewayURL.toUrl,
|
||||
jsonEncode({
|
||||
'gatewayId': gatewayId,
|
||||
'gatewayName': gatewayName,
|
||||
}));
|
||||
}),
|
||||
timeout: timeout);
|
||||
|
||||
// 远程开锁
|
||||
Future<Response> remoteOpenLock(
|
||||
String lockId,
|
||||
) =>
|
||||
post(
|
||||
remoteOpenLockURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
}));
|
||||
Future<Response> remoteOpenLock(String lockId, int timeOut) => post(
|
||||
remoteOpenLockURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
}),
|
||||
timeout: timeOut);
|
||||
|
||||
// 转移网关确认
|
||||
Future<Response> transferGatewayConfirmInfoData(
|
||||
@ -1808,14 +1810,17 @@ class ApiProvider extends BaseProvider {
|
||||
}));
|
||||
|
||||
// 获取网关配置
|
||||
Future<Response> getGatewayConfiguration() =>
|
||||
post(getGatewayConfigURL.toUrl, jsonEncode({}));
|
||||
Future<Response> getGatewayConfiguration(int timeout) =>
|
||||
post(getGatewayConfigURL.toUrl, jsonEncode({}), timeout: timeout);
|
||||
|
||||
Future<Response> gatewayConnectionLockListLoadData(int gatewayId) =>
|
||||
post(gatewayListByLockURL.toUrl, jsonEncode({'gatewayId': gatewayId}));
|
||||
Future<Response> gatewayConnectionLockListLoadData(
|
||||
int gatewayId, int timeout) =>
|
||||
post(gatewayListByLockURL.toUrl, jsonEncode({'gatewayId': gatewayId}),
|
||||
timeout: timeout);
|
||||
|
||||
Future<Response> gatewayScanDevice(int gatewayId) =>
|
||||
post(gatewayScanDeviceURL.toUrl, jsonEncode({'gatewayId': gatewayId}));
|
||||
Future<Response> gatewayScanDevice(int gatewayId, int timeout) =>
|
||||
post(gatewayScanDeviceURL.toUrl, jsonEncode({'gatewayId': gatewayId}),
|
||||
timeout: timeout);
|
||||
|
||||
// 移除坏锁
|
||||
Future<Response> removeBrokenLockData(List lockIdList) =>
|
||||
|
||||
@ -37,6 +37,7 @@ class BaseProvider extends GetConnect with Api {
|
||||
bool? isUserBaseUrl = true, // 文件上传不使用baseUrl
|
||||
bool? isShowErrMsg = true, // 是否显示没有网络时的提示
|
||||
bool? isShowNetworkErrorMsg = true, // 是否显示网络其他报错 如403 500等
|
||||
int? timeout = 15,
|
||||
}) async {
|
||||
AppLog.log('post: url:$url body:$body');
|
||||
if (isUnShowLoading == false) {
|
||||
@ -47,6 +48,8 @@ class BaseProvider extends GetConnect with Api {
|
||||
} else {
|
||||
httpClient.baseUrl = '${F.apiPrefix}/api';
|
||||
}
|
||||
httpClient.timeout = timeout!.seconds;
|
||||
// AppLog.log('timeout:$timeout httpClient.timeout:${httpClient.timeout}');
|
||||
var res = await super.post(url, body,
|
||||
contentType: contentType,
|
||||
headers: headers,
|
||||
@ -78,7 +81,7 @@ class BaseProvider extends GetConnect with Api {
|
||||
statusText: res.statusText,
|
||||
);
|
||||
} else {}
|
||||
if(isShowNetworkErrorMsg ?? true){
|
||||
if (isShowNetworkErrorMsg ?? true) {
|
||||
getDataResult(res.body);
|
||||
}
|
||||
return res;
|
||||
|
||||
@ -1912,22 +1912,24 @@ class ApiRepository {
|
||||
|
||||
// 获取网关列表
|
||||
Future<GetewayDataEntity> getGatewayListData(
|
||||
{required String pageNo, required String pageSize}) async {
|
||||
final res = await apiProvider.getGatewayListData(pageNo, pageSize);
|
||||
{required String pageNo,
|
||||
required String pageSize,
|
||||
required int timeout}) async {
|
||||
final res = await apiProvider.getGatewayListData(pageNo, pageSize, timeout);
|
||||
return GetewayDataEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 添加网关
|
||||
Future<LoginEntity> gatewayDistributionNetwork({
|
||||
required String gatewayName,
|
||||
required String gatewayMac,
|
||||
required String serialNumber,
|
||||
required int gatewayType,
|
||||
required String networkName,
|
||||
required String networkMac,
|
||||
required String version,
|
||||
required Map gatewayJson,
|
||||
}) async {
|
||||
Future<LoginEntity> gatewayDistributionNetwork(
|
||||
{required String gatewayName,
|
||||
required String gatewayMac,
|
||||
required String serialNumber,
|
||||
required int gatewayType,
|
||||
required String networkName,
|
||||
required String networkMac,
|
||||
required String version,
|
||||
required Map gatewayJson,
|
||||
required int timeout}) async {
|
||||
final res = await apiProvider.addGatewayNetwork(
|
||||
gatewayName,
|
||||
gatewayMac,
|
||||
@ -1936,25 +1938,27 @@ class ApiRepository {
|
||||
networkName,
|
||||
networkMac,
|
||||
version,
|
||||
gatewayJson);
|
||||
gatewayJson,
|
||||
timeout);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 删除网关
|
||||
Future<LoginEntity> gatewayDelet({
|
||||
required int gatewayId,
|
||||
required int isForce,
|
||||
}) async {
|
||||
final res = await apiProvider.deletGateway(gatewayId, isForce);
|
||||
Future<LoginEntity> gatewayDelet(
|
||||
{required int gatewayId,
|
||||
required int isForce,
|
||||
required int timeout}) async {
|
||||
final res = await apiProvider.deletGateway(gatewayId, isForce, timeout);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 网关更新
|
||||
Future<LoginEntity> gatewayUpdate({
|
||||
required int gatewayId,
|
||||
required String gatewayName,
|
||||
}) async {
|
||||
final res = await apiProvider.gatewayUpdate(gatewayId, gatewayName);
|
||||
Future<LoginEntity> gatewayUpdate(
|
||||
{required int gatewayId,
|
||||
required String gatewayName,
|
||||
required int timeout}) async {
|
||||
final res =
|
||||
await apiProvider.gatewayUpdate(gatewayId, gatewayName, timeout);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -1970,22 +1974,23 @@ class ApiRepository {
|
||||
|
||||
// 网关-附近的锁
|
||||
Future<GatewayConnectionLockListEntity> gatewayConnectionLockLoadData(
|
||||
{required int gatewayId}) async {
|
||||
final res = await apiProvider.gatewayConnectionLockListLoadData(gatewayId);
|
||||
{required int gatewayId, required int timeout}) async {
|
||||
final res =
|
||||
await apiProvider.gatewayConnectionLockListLoadData(gatewayId, timeout);
|
||||
return GatewayConnectionLockListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 网关-扫描设备
|
||||
Future<LoginEntity> gatewayScanDevice({
|
||||
required int gatewayId,
|
||||
}) async {
|
||||
final res = await apiProvider.gatewayScanDevice(gatewayId);
|
||||
Future<LoginEntity> gatewayScanDevice(
|
||||
{required int gatewayId, required int timeout}) async {
|
||||
final res = await apiProvider.gatewayScanDevice(gatewayId, timeout);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 远程开锁
|
||||
Future<LoginEntity> remoteOpenLock({required String lockId}) async {
|
||||
final res = await apiProvider.remoteOpenLock(lockId);
|
||||
Future<LoginEntity> remoteOpenLock(
|
||||
{required String lockId, required int timeOut}) async {
|
||||
final res = await apiProvider.remoteOpenLock(lockId, timeOut);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -2000,8 +2005,9 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
// 获取网关配置
|
||||
Future<GetGatewayConfigurationEntity> getGatewayConfiguration() async {
|
||||
final res = await apiProvider.getGatewayConfiguration();
|
||||
Future<GetGatewayConfigurationEntity> getGatewayConfiguration(
|
||||
{required int timeout}) async {
|
||||
final res = await apiProvider.getGatewayConfiguration(timeout);
|
||||
return GetGatewayConfigurationEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
|
||||
@ -104,7 +104,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# 1.0.85+2024120301:完善网关功能
|
||||
# 1.0.85+2024120401:修复网关问题,打包给谢敬调试
|
||||
|
||||
version: 1.0.85+2024121301
|
||||
version: 1.0.85+2024123102
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user