|
@@ -47,14 +47,15 @@ class WeixinAuthService extends AxiosService {
|
|
|
const { code, state } = query;
|
|
|
if (!code) throw new BusinessError(ErrorCode.SERVICE_FAULT, '授权未成功');
|
|
|
const { appid, appSecret } = this.wxInfo;
|
|
|
- const url = 'https://api.weixin.qq.com/sns/oauth2/access_token';
|
|
|
- const params = {
|
|
|
- appid,
|
|
|
- secret: appSecret,
|
|
|
- code,
|
|
|
- grant_type: 'authorization_code',
|
|
|
- };
|
|
|
- const req = await this.httpGet(url, params);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const req = await this.httpGet('/api/fetch', { code });
|
|
|
if (req.errcode && req.errcode !== 0) throw new BusinessError(ErrorCode.SERVICE_FAULT, 'openid获取失败');
|
|
|
const openid = _.get(req, 'openid');
|
|
|
const access_token = await this.app.redis.get(this.access_tokenKey);
|