wx.js 632 B

123456789101112131415161718192021
  1. 'use strict';
  2. const Controller = require('egg').Controller;
  3. const { BusinessError, ErrorCode } = require('naf-core').Error;
  4. const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
  5. // 微信接口
  6. class WxController extends Controller {
  7. constructor(ctx) {
  8. super(ctx);
  9. this.params = this.ctx.params;
  10. this.queryObject = this.ctx.request.query;
  11. this.reqBody = this.ctx.request.body;
  12. this.service = this.ctx.service.wx;
  13. }
  14. async getOpenid() {
  15. const data = await this.service.appAuth(this.ctx.query);
  16. this.ctx.ok(data);
  17. }
  18. }
  19. module.exports = CrudController(WxController, {});