weixin.js 591 B

123456789101112131415161718192021
  1. 'use strict';
  2. const Controller = require('egg').Controller;
  3. const { CrudController } = require('naf-framework-mongoose/lib/controller');
  4. class WeixinController extends Controller {
  5. constructor(ctx) {
  6. super(ctx);
  7. this.service = this.ctx.service.weixin;
  8. }
  9. async auth() {
  10. await this.service.auth(this.ctx.query);
  11. }
  12. async authBack() {
  13. await this.service.authBack(this.ctx.query);
  14. }
  15. async jsapiAuth() {
  16. const res = await this.service.jsapiAuth(this.ctx.request.body);
  17. this.ctx.ok({ data: res });
  18. }
  19. }
  20. module.exports = CrudController(WeixinController, {});