|
@ -1,18 +1,20 @@ |
|
|
const { |
|
|
const { |
|
|
getSettingByCoopId, |
|
|
getSettingByCoopId, |
|
|
changeSetting, |
|
|
changeSetting, |
|
|
|
|
|
getControlInfoList, |
|
|
} = require("../service/control.service"); |
|
|
} = require("../service/control.service"); |
|
|
const Response = require("../utils/response"); |
|
|
const Response = require("../utils/response"); |
|
|
|
|
|
|
|
|
class ControlController { |
|
|
class ControlController { |
|
|
async detail(ctx, next) { |
|
|
async detail(ctx, next) { |
|
|
const { coop_id } = ctx.request.query; |
|
|
|
|
|
const res = await getSettingByCoopId(coop_id); |
|
|
|
|
|
|
|
|
const { house_id, coop_id } = ctx.request.body; |
|
|
|
|
|
const res = await getSettingByCoopId(house_id, coop_id); |
|
|
ctx.body = Response(0, "获取环境控制设定成功", res); |
|
|
ctx.body = Response(0, "获取环境控制设定成功", res); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async change(ctx, next) { |
|
|
async change(ctx, next) { |
|
|
const { |
|
|
const { |
|
|
|
|
|
house_id, |
|
|
coop_id, |
|
|
coop_id, |
|
|
temperature_start, |
|
|
temperature_start, |
|
|
temperature_end, |
|
|
temperature_end, |
|
@ -23,6 +25,7 @@ class ControlController { |
|
|
current_h2s, |
|
|
current_h2s, |
|
|
} = ctx.request.body; |
|
|
} = ctx.request.body; |
|
|
const res = await changeSetting( |
|
|
const res = await changeSetting( |
|
|
|
|
|
house_id, |
|
|
coop_id, |
|
|
coop_id, |
|
|
temperature_start, |
|
|
temperature_start, |
|
|
temperature_end, |
|
|
temperature_end, |
|
@ -34,6 +37,12 @@ class ControlController { |
|
|
); |
|
|
); |
|
|
ctx.body = Response(0, "改变环境设定值成功", res); |
|
|
ctx.body = Response(0, "改变环境设定值成功", res); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async list(ctx, next) { |
|
|
|
|
|
const { house_id, batch_number, coop_id } = ctx.request.body; |
|
|
|
|
|
const res = await getControlInfoList(house_id, batch_number, coop_id); |
|
|
|
|
|
ctx.body = Response(0, "查询智能控制列表成功", res); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
module.exports = new ControlController(); |
|
|
module.exports = new ControlController(); |