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