index.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 'use strict';
  2. /**
  3. * [微信公众号通讯路由]
  4. * @author szjcomo
  5. * @createTime 2020-08-03
  6. * @param {[type]} app [description]
  7. * @return {[type]} [description]
  8. */
  9. module.exports = app => {
  10. /**
  11. * [subRouter 命名空间路由]
  12. * @type {[type]}
  13. */
  14. const subRouter = app.router.namespace(`/${process.env.APP_CUSTOME || 'universal'}`);
  15. // 通讯验证
  16. subRouter.get('/wechat/validate', app.controller.wechat.wechat.tokenSign);
  17. // 接收消息
  18. subRouter.post('/wechat/validate', app.controller.wechat.wechat.message);
  19. // 微信JSAPI
  20. subRouter.get('/wechat/jsapi', app.controller.wechat.wechat.wxJsAPIConfig);
  21. // 微信支付回调
  22. subRouter.post('/wechat/pay/callbck', app.controller.wechat.wechat.payCallback);
  23. };
  24. // <xml><appid><![CDATA[wx6aab892e5b7b6023]]></appid>
  25. // <attach><![CDATA[{&quot;user_id&quot;:2,&quot;order_id&quot;:21,&quot;scene_info&quot;:&quot;orderCreate&quot;}]]></attach>
  26. // <bank_type><![CDATA[OTHERS]]></bank_type>
  27. // <cash_fee><![CDATA[10]]></cash_fee>
  28. // <fee_type><![CDATA[CNY]]></fee_type>
  29. // <is_subscribe><![CDATA[Y]]></is_subscribe>
  30. // <mch_id><![CDATA[1490421362]]></mch_id>
  31. // <nonce_str><![CDATA[IHxRkUVRR2QfCVAcawWLqTXIsihbu2PI]]></nonce_str>
  32. // <openid><![CDATA[okXHRwVqk39baIntOSADkiFLSNNQ]]></openid>
  33. // <out_trade_no><![CDATA[20220329150651146468]]></out_trade_no>
  34. // <result_code><![CDATA[SUCCESS]]></result_code>
  35. // <return_code><![CDATA[SUCCESS]]></return_code>
  36. // <sign><![CDATA[22FE37BA8C5E42BA0891D8D0A8BDFCC9]]></sign>
  37. // <time_end><![CDATA[20220329150706]]></time_end>
  38. // <total_fee>10</total_fee>
  39. // <trade_type><![CDATA[JSAPI]]></trade_type>
  40. // <transaction_id><![CDATA[4200001367202203291541331216]]></transaction_id>
  41. // </xml>