lrf402788946 4 년 전
부모
커밋
59210721ce
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      app/service/wxpay.js

+ 5 - 1
app/service/wxpay.js

@@ -20,7 +20,11 @@ class WxpayService extends CrudService {
   async toAuth({ code, id }) {
     const token = await this.redis.get(id);
     console.log(`token=>${token}`);
-    if (token) return;
+    if (token) {
+      console.log('in if');
+      return;
+    }
+    console.log('in else');
     const url = ({ id, secret }) => `https://api.weixin.qq.com/sns/jscode2session?appid=${id}&secret=${secret}&js_code=${code}&grant_type=authorization_code`;
     console.log(`url=>${url(this.appInfo)}`);
     const res = await this.ctx.curl(url(this.appInfo), {