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

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. const {
  2. getHouseListById,
  3. createHouse,
  4. updateHouse,
  5. } = require("../service/house.service");
  6. const Response = require("../utils/response");
  7. class HouseController {
  8. async list(ctx, next) {
  9. const { id: belong, role } = ctx.state.user;
  10. const res = await getHouseListById(belong, role);
  11. ctx.body = Response(0, "查询鸡厂列表成功", res);
  12. }
  13. async create(ctx, next) {
  14. const { belong, house_name, area } = ctx.request.body;
  15. const res = await createHouse(belong, house_name, area);
  16. ctx.body = Response(0, "新增鸡厂成功", res);
  17. }
  18. async update(ctx, next) {
  19. const { belong, house_name, area, id } = ctx.request.body;
  20. const res = await updateHouse(belong, house_name, area, id);
  21. ctx.body = Response(0, "更新鸡厂信息成功", res);
  22. }
  23. }
  24. module.exports = new HouseController();