login.js 790 B

1234567891011121314151617181920212223242526272829303132333435363738
  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 wxlogin() {
  15. const res = await this.service.wxlogin(this.ctx.request.body);
  16. this.ctx.ok({ data: res });
  17. }
  18. // POST 生成二维码
  19. async qrcode() {
  20. const res = await this.service.createQrcode();
  21. this.ctx.ok({ data: res });
  22. }
  23. // POST 检查二维码
  24. async wxcheck() {
  25. const res = await this.service.wxcheck(this.ctx.request.body);
  26. this.ctx.ok(res);
  27. }
  28. }
  29. module.exports = LoginController;