wechat_auth.js 900 B

123456789101112131415161718192021222324252627282930313233
  1. 'use strict';
  2. // 加密类
  3. const crypto = require('crypto');
  4. const messageType = require('../const/message_type');
  5. module.exports = options => {
  6. /**
  7. * session判断中间件
  8. *
  9. * @param {function} next - 中间件继续执行的方法
  10. * @return {void}
  11. */
  12. return function* wechatAuth(next) {
  13. try {
  14. // 判断session
  15. // const wechatToken = this.session.wechatToken;
  16. // if (wechatToken === undefined) {
  17. // throw '不存在session';
  18. // }
  19. // // 同步系统维护信息
  20. // yield this.service.maintain.syncMaintainData();
  21. // if (this.session === null) {
  22. // throw '系统维护中~';
  23. // }
  24. } catch (error) {
  25. console.log(error);
  26. this.body = error;
  27. return;
  28. }
  29. yield next;
  30. };
  31. };