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();