石墨消解仪后端用nodejs编写,与嵌入式端交互和前端交互均用ws
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

39 lines
904 B

const {
getSettingByCoopId,
changeSetting,
} = require("../service/control.service");
const Response = require("../utils/response");
class ControlController {
async detail(ctx, next) {
const { coop_id } = ctx.request.query;
const res = await getSettingByCoopId(coop_id);
ctx.body = Response(0, "获取环境控制设定成功", res);
}
async change(ctx, next) {
const {
coop_id,
temperature_start,
temperature_end,
humidity_start,
humidity_end,
current_co2,
current_nh3,
current_h2s,
} = ctx.request.body;
const res = await changeSetting(
coop_id,
temperature_start,
temperature_end,
humidity_start,
humidity_end,
current_co2,
current_nh3,
current_h2s
);
ctx.body = Response(0, "改变环境设定值成功", res);
}
}
module.exports = new ControlController();