user.js 905 B

12345678910111213141516171819202122232425262728293031323334353637
  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. class UserController extends Controller {
  7. constructor(ctx) {
  8. super(ctx);
  9. this.service = this.ctx.service.user;
  10. }
  11. async uppasswd() {
  12. const res = await this.service.uppasswd(this.ctx.request.body);
  13. this.ctx.ok({ data: res });
  14. }
  15. async querymenus() {
  16. const res = await this.service.querymenus(this.ctx.query);
  17. this.ctx.ok({ data: res });
  18. }
  19. async updatebyuid() {
  20. const res = await this.service.updatebyuid(this.ctx.params, this.ctx.request.body);
  21. this.ctx.ok({ data: res });
  22. }
  23. async bind() {
  24. const res = await this.service.bind(this.ctx.request.body);
  25. this.ctx.ok({ data: res });
  26. }
  27. }
  28. module.exports = CrudController(UserController, meta);