login.js 731 B

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