解绑设备
This commit is contained in:
@@ -8,6 +8,7 @@ import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||
|
||||
import 'package:vbvs_app/controller/mh_controller/device.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
@@ -19,7 +20,6 @@ class DeviceListModel {
|
||||
//设备列表
|
||||
List<dynamic> deviceList = [];
|
||||
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
String? keyword;
|
||||
@JsonKey(ignore: true)
|
||||
@@ -70,4 +70,35 @@ class DeviceListController extends GetControllerEx<DeviceListModel> {
|
||||
}
|
||||
return ApiResponse(code: -1, msg: "未知错误".tr); // Default return statement
|
||||
}
|
||||
|
||||
//解绑设备
|
||||
Future<String> unbindDevice(Map<dynamic, dynamic> device) async {
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.device_bind;
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||
String msg = '';
|
||||
int type = device['bind_type'];
|
||||
await requestWithLog(
|
||||
logTitle: '解绑设备',
|
||||
method: MyHttpMethod.delete,
|
||||
queryUrl: queryUrl,
|
||||
data: {"mac": device['mac'], "uid": device['uid']},
|
||||
onSuccess: (res) {
|
||||
if (type == 1) {
|
||||
msg = '解绑成功'.tr;
|
||||
} else {
|
||||
msg = '删除成功'.tr;
|
||||
}
|
||||
},
|
||||
onFailure: (res) {
|
||||
if (type == 1) {
|
||||
msg = '解绑失败'.tr;
|
||||
} else {
|
||||
msg = '删除失败'.tr;
|
||||
}
|
||||
},
|
||||
);
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user