weixin.js 598 B

12345678910111213141516171819202122
  1. 'use strict';
  2. const Controller = require('egg').Controller;
  3. const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
  4. // 微信
  5. class WeixinController extends Controller {
  6. constructor(ctx) {
  7. super(ctx);
  8. this.service = this.ctx.service.system.weixin;
  9. }
  10. async appAuth() {
  11. const data = await this.service.appAuth(this.ctx.query, this.ctx.tenant);
  12. this.ctx.ok({ data });
  13. }
  14. async decrypt() {
  15. const data = await this.service.getSecret(this.ctx.request.body);
  16. this.ctx.ok({ data });
  17. }
  18. }
  19. module.exports = CrudController(WeixinController, {});