bedroom.js 830 B

1234567891011121314151617181920212223242526272829303132333435
  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. console.log(this.ctx.request.body);
  19. const res = await this.service.ibeacon(this.ctx.request.body);
  20. this.ctx.ok({ ...res });
  21. }
  22. async roomstu() {
  23. const data = await this.service.roomstu(this.ctx.params);
  24. this.ctx.ok({ data });
  25. }
  26. }
  27. module.exports = CrudController(BedroomController, meta);