|
@@ -34,12 +34,13 @@ class WeixinAuthService extends Service {
|
|
|
dataType: 'json',
|
|
|
});
|
|
|
if (result) {
|
|
|
- console.log(result);
|
|
|
+ // console.log(result);
|
|
|
const val = JSON.stringify(result.data);
|
|
|
await this.app.redis.set(key, val, 'EX', 7200);
|
|
|
data.access_token = result.data.access_token;
|
|
|
}
|
|
|
}
|
|
|
+ console.log(`data=>${data}`);
|
|
|
return data;
|
|
|
}
|
|
|
|
|
@@ -48,7 +49,7 @@ class WeixinAuthService extends Service {
|
|
|
assert(appid, '缺少appid参数项');
|
|
|
const result = await this.accesstoken({ appid });
|
|
|
const accesstoken = result.access_token;
|
|
|
- console.log(accesstoken);
|
|
|
+ console.log(`accesstoken=>${accesstoken}`);
|
|
|
assert(accesstoken, '缺少access_token参数项');
|
|
|
const key = `visit:auth:jsapiticket:${appid}`;
|
|
|
const val = await this.app.redis.get(key);
|
|
@@ -66,7 +67,7 @@ class WeixinAuthService extends Service {
|
|
|
dataType: 'json',
|
|
|
});
|
|
|
if (result) {
|
|
|
- console.log(result);
|
|
|
+ // console.log(result);
|
|
|
if (result.data.errcode === 0) {
|
|
|
const val = JSON.stringify(result.data);
|
|
|
await this.app.redis.set(key, val, 'EX', 7200);
|
|
@@ -86,7 +87,7 @@ class WeixinAuthService extends Service {
|
|
|
// const { wxapi } = this.app.config;
|
|
|
// const appidlist = wxapi;
|
|
|
// const wxapp = _.find(appidlist, { appid });
|
|
|
- console.log(url);
|
|
|
+ console.log(`url=>${url}`);
|
|
|
const noncestr = await this.createNonceStr();
|
|
|
const timestamp = await this.createTimestamp();
|
|
|
const ret = {
|
|
@@ -95,11 +96,11 @@ class WeixinAuthService extends Service {
|
|
|
timestamp,
|
|
|
url,
|
|
|
};
|
|
|
- console.log(ret);
|
|
|
+ console.log(ret.data);
|
|
|
const string = await this.raw(ret);
|
|
|
ret.sign = await this.sha1(string);
|
|
|
ret.appid = appid;
|
|
|
- console.log('ret', ret);
|
|
|
+ // console.log('ret', ret);
|
|
|
return ret;
|
|
|
}
|
|
|
|