石墨消解仪后端用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.
 

28 lines
838 B

const {
getHouseListById,
createHouse,
updateHouse,
} = require("../service/house.service");
const Response = require("../utils/response");
class HouseController {
async list(ctx, next) {
const { id: belong, role } = ctx.state.user;
const res = await getHouseListById(belong, role);
ctx.body = Response(0, "查询鸡厂列表成功", res);
}
async create(ctx, next) {
const { belong, house_name, area } = ctx.request.body;
const res = await createHouse(belong, house_name, area);
ctx.body = Response(0, "新增鸡厂成功", res);
}
async update(ctx, next) {
const { belong, house_name, area, id } = ctx.request.body;
const res = await updateHouse(belong, house_name, area, id);
ctx.body = Response(0, "更新鸡厂信息成功", res);
}
}
module.exports = new HouseController();