wechat.js 743 B

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. const assert = require('assert');
  3. const _ = require('lodash');
  4. const uuid = require('uuid');
  5. const urljoin = require('url-join');
  6. const Controller = require('egg').Controller;
  7. class WechatController extends Controller {
  8. // 取得微信AccessToken
  9. async accesstoken() {
  10. const res = await this.ctx.service.weixin.accesstoken(this.ctx.query);
  11. this.ctx.ok({ res });
  12. }
  13. // 取得微信jsapiticket
  14. async jsapiticket() {
  15. const res = await this.ctx.service.weixin.jsapiticket(this.ctx.query);
  16. this.ctx.ok({ res });
  17. }
  18. // 取得微信getsign
  19. async getsign() {
  20. const data = await this.ctx.service.weixin.getsign(this.ctx.query);
  21. this.ctx.ok({ data });
  22. }
  23. }
  24. module.exports = WechatController;