bedroom.js 790 B

12345678910111213141516171819202122232425262728293031323334
  1. 'use strict';
  2. const _ = require('lodash');
  3. const meta = require('./.bedroom.js');
  4. const Controller = require('egg').Controller;
  5. const { CrudController } = require('naf-framework-mongoose/lib/controller');
  6. // 寝室管理
  7. class BedroomController extends Controller {
  8. constructor(ctx) {
  9. super(ctx);
  10. this.service = this.ctx.service.bedroom;
  11. }
  12. // 一键分寝
  13. async apart() {
  14. const res = await this.service.apart(this.ctx.request.body);
  15. this.ctx.ok({ data: res });
  16. }
  17. async ibeacon() {
  18. const res = await this.service.ibeacon(this.ctx.request.body);
  19. this.ctx.ok({ ...res });
  20. }
  21. async roomstu() {
  22. const data = await this.service.roomstu(this.ctx.params);
  23. this.ctx.ok({ data });
  24. }
  25. }
  26. module.exports = CrudController(BedroomController, meta);