|
@@ -126,29 +126,33 @@ class WxService extends Service {
|
|
|
}
|
|
|
|
|
|
async getUserInfo(openid) {
|
|
|
- const config = this.ctx.app.config.wechat_config;
|
|
|
- const getAccessTokenUrl = config.getAccessToken.replace('APPID', 'wx91e8f7300e266ad1')
|
|
|
- .replace('APPSECRET', '18ed843ea5147e338dfd987d9ddf1085');
|
|
|
- const getAccessTokenRes = await this.ctx.curl(getAccessTokenUrl, {
|
|
|
- dataType: 'json',
|
|
|
- });
|
|
|
- this.ctx.logger.info('AccessToken=================' + getAccessTokenRes);
|
|
|
- const access_token = getAccessTokenRes.data.access_token;
|
|
|
- const url = config.getUserInfo.replace('ACCESS_TOKEN', access_token)
|
|
|
- .replace('OPENID', openid);
|
|
|
- const res = await this.ctx.curl(url, {
|
|
|
- dataType: 'json',
|
|
|
- });
|
|
|
- this.ctx.logger.info('UserInfo=================' + res);
|
|
|
- return res.data;
|
|
|
// const config = this.ctx.app.config.wechat_config;
|
|
|
+ // const getAccessTokenUrl = config.getAccessToken.replace('APPID', 'wx91e8f7300e266ad1')
|
|
|
+ // .replace('APPSECRET', '18ed843ea5147e338dfd987d9ddf1085');
|
|
|
+ // const getAccessTokenRes = await this.ctx.curl(getAccessTokenUrl, {
|
|
|
+ // dataType: 'json',
|
|
|
+ // });
|
|
|
+ // const access_token = getAccessTokenRes.data.access_token;
|
|
|
+
|
|
|
// const access_token = await this.app.redis.get('access_token');
|
|
|
+ // this.ctx.logger.info('AccessToken=================' + access_token);
|
|
|
// const url = config.getUserInfo.replace('ACCESS_TOKEN', access_token)
|
|
|
// .replace('OPENID', openid);
|
|
|
// const res = await this.ctx.curl(url, {
|
|
|
// dataType: 'json',
|
|
|
// });
|
|
|
+ // this.ctx.logger.info('UserInfo=================' + res);
|
|
|
// return res.data;
|
|
|
+
|
|
|
+ // --------------------
|
|
|
+ const config = this.ctx.app.config.wechat_config;
|
|
|
+ const access_token = await this.app.redis.get('access_token');
|
|
|
+ const url = config.getUserInfo.replace('ACCESS_TOKEN', access_token)
|
|
|
+ .replace('OPENID', openid);
|
|
|
+ const res = await this.ctx.curl(url, {
|
|
|
+ dataType: 'json',
|
|
|
+ });
|
|
|
+ return res.data;
|
|
|
}
|
|
|
|
|
|
async getSign(data) {
|