更新同步遥控器
This commit is contained in:
@@ -560,4 +560,79 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
//开启定时器
|
||||
void startTimer(args) {
|
||||
var tmp = args[0];
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.user_setting;
|
||||
String type = "control_${tmp['mac']}";
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||
var data = {
|
||||
"type": type,
|
||||
"duration": tmp['duration'],
|
||||
"mac": tmp['mac'],
|
||||
"time": tmp['startTime'],
|
||||
};
|
||||
requestWithLog(
|
||||
logTitle: "更新控制倒计时",
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
onSuccess: (res) {});
|
||||
}
|
||||
|
||||
//关闭定时器
|
||||
void cancelTimer(args) {
|
||||
var tmp = args[0];
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.user_setting;
|
||||
String type = "control_${tmp['mac']}";
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||
var data = {
|
||||
"type": type,
|
||||
"duration": 0,
|
||||
"mac": tmp['mac'],
|
||||
"time": tmp['startTime'],
|
||||
};
|
||||
requestWithLog(
|
||||
logTitle: "查询控制倒计时",
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
onSuccess: (res) {});
|
||||
}
|
||||
|
||||
//恢复
|
||||
restoreTimer(args) async {
|
||||
var data = {};
|
||||
try {
|
||||
var tmp = args[0];
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.user_setting;
|
||||
String type = "control_${tmp}";
|
||||
String queryUrl =
|
||||
"${serviceAddress}${serviceName}${serviceApi}?type=$type";
|
||||
await requestWithLog(
|
||||
logTitle: "查询控制倒计时",
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
if (res.data != null) {
|
||||
data = res.data;
|
||||
}
|
||||
},
|
||||
onFailure: (res) {
|
||||
data = {};
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
ef.log("$e");
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user