user.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. 'use strict';
  2. const _ = require('lodash');
  3. const meta = require('./.user.js');
  4. const Controller = require('egg').Controller;
  5. const { CrudController } = require('naf-framework-mongoose/lib/controller');
  6. // 管理
  7. class UserController extends Controller {
  8. constructor(ctx) {
  9. super(ctx);
  10. this.service = this.ctx.service.user;
  11. }
  12. async uppasswd() {
  13. const res = await this.service.uppasswd(this.ctx.request.body);
  14. this.ctx.ok({ data: res });
  15. }
  16. async querymenus() {
  17. const res = await this.service.querymenus(this.ctx.query);
  18. this.ctx.ok({ data: res });
  19. }
  20. async updatebyuid() {
  21. const res = await this.service.updatebyuid(
  22. this.ctx.params,
  23. this.ctx.request.body
  24. );
  25. this.ctx.ok({ data: res });
  26. }
  27. async bind() {
  28. const res = await this.service.bind(this.ctx.request.body);
  29. this.ctx.ok({ data: res });
  30. }
  31. async finduserlist() {
  32. const res = await this.service.finduserlist(this.ctx.query);
  33. this.ctx.ok({ ...res });
  34. }
  35. async businessuser() {
  36. const res = await this.service.businessuser(this.ctx.query);
  37. this.ctx.ok({ ...res });
  38. }
  39. }
  40. module.exports = CrudController(UserController, meta);