lookuser.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 'use strict';
  2. const _ = require('lodash');
  3. const meta = require('./.lookuser.js');
  4. const Controller = require('egg').Controller;
  5. const { CrudController } = require('naf-framework-mongoose/lib/controller');
  6. // 管理
  7. class LookuserController extends Controller {
  8. constructor(ctx) {
  9. super(ctx);
  10. this.service = this.ctx.service.lookuser;
  11. }
  12. async update() {
  13. const res = await this.service.update(this.ctx.params, this.ctx.request.body);
  14. this.ctx.ok({ data: res });
  15. }
  16. async roomcount() {
  17. const data = await this.service.roomcount(this.ctx.query);
  18. this.ctx.ok({ ...data });
  19. }
  20. async swichrole() {
  21. const res = await this.service.userswichrole(this.ctx.query);
  22. this.ctx.ok({ data: res });
  23. }
  24. async updatexf() {
  25. const res = await this.service.updatexf(this.ctx.request.body);
  26. this.ctx.ok({ data: res });
  27. }
  28. async index() {
  29. const data = await this.service.query(this.ctx.query);
  30. this.ctx.ok({ ...data });
  31. }
  32. }
  33. module.exports = CrudController(LookuserController, meta);