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