room.js 575 B

1234567891011121314151617181920212223242526272829
  1. 'use strict';
  2. const _ = require('lodash');
  3. const Controller = require('egg').Controller;
  4. // 房间管理
  5. class RoomController extends Controller {
  6. constructor(ctx) {
  7. super(ctx);
  8. this.service = this.ctx.service.room;
  9. }
  10. // 查询列表
  11. async index() {
  12. const data = await this.service.query(this.ctx.query);
  13. this.ctx.ok({ data });
  14. }
  15. // DELETE /{id}
  16. // 删除房间信息
  17. async destroy() {
  18. const { id } = this.ctx.params;
  19. await this.service.delete({ id });
  20. this.ctx.ok({ msg: 'deleted' });
  21. }
  22. }
  23. module.exports = RoomController;