login.js 760 B

1234567891011121314151617181920212223242526272829303132333435
  1. 'use strict';
  2. const _ = require('lodash');
  3. const Controller = require('egg').Controller;
  4. // 登录管理
  5. class LoginController extends Controller {
  6. constructor(ctx) {
  7. super(ctx);
  8. this.service = this.ctx.service.login;
  9. }
  10. async login() {
  11. const res = await this.service.login(this.ctx.request.body);
  12. this.ctx.ok({ data: res });
  13. }
  14. async token() {
  15. const res = await this.service.token(this.ctx.request.body);
  16. this.ctx.ok({ data: res });
  17. }
  18. async destroy() {
  19. const res = await this.service.destroy(this.ctx.request.body);
  20. this.ctx.ok({ data: res });
  21. }
  22. async wxlogin() {
  23. const res = await this.service.wxlogin(this.ctx.request.body);
  24. this.ctx.ok({ data: res });
  25. }
  26. }
  27. module.exports = LoginController;