|
@@ -16,21 +16,21 @@ class WeixinAuthService extends AxiosService {
|
|
|
async fetch(code) {
|
|
|
// TODO:参数检查和默认参数处理
|
|
|
assert(code);
|
|
|
- const { wxapi } = this.app.config;
|
|
|
- let res = await this.httpGet('/api/fetch', { code });
|
|
|
+ // const { wxapi } = this.app.config;
|
|
|
+ const res = await this.httpGet('/api/fetch', { code });
|
|
|
if (res.errcode && res.errcode !== 0) {
|
|
|
this.ctx.logger.error(`[WeixinAuthService] fetch open by code fail, errcode: ${res.errcode}, errmsg: ${res.errmsg}`);
|
|
|
throw new BusinessError(ErrorCode.SERVICE_FAULT, '获得微信认证信息失败');
|
|
|
}
|
|
|
- const { openid } = res;
|
|
|
+ // const { openid } = res;
|
|
|
console.log('1res' + JSON.stringify(res));
|
|
|
- // TODO: 获得用户信息
|
|
|
- res = await this.httpGet('/api.weixin.qq.com/cgi-bin/user/info?lang=zh_CN', { appid: wxapi.appid, openid });
|
|
|
- // console.debug('res: ', res);
|
|
|
- if (res.errcode && res.errcode !== 0) {
|
|
|
- this.ctx.logger.error(`[WeixinAuthService] fetch userinfo by openid fail, errcode: ${res.errcode}, errmsg: ${res.errmsg}`);
|
|
|
- throw new BusinessError(ErrorCode.SERVICE_FAULT, '获得微信用户信息失败');
|
|
|
- }
|
|
|
+ // // TODO: 获得用户信息
|
|
|
+ // res = await this.httpGet('/api.weixin.qq.com/cgi-bin/user/info?lang=zh_CN', { appid: wxapi.appid, openid });
|
|
|
+ // // console.debug('res: ', res);
|
|
|
+ // if (res.errcode && res.errcode !== 0) {
|
|
|
+ // this.ctx.logger.error(`[WeixinAuthService] fetch userinfo by openid fail, errcode: ${res.errcode}, errmsg: ${res.errmsg}`);
|
|
|
+ // throw new BusinessError(ErrorCode.SERVICE_FAULT, '获得微信用户信息失败');
|
|
|
+ // }
|
|
|
return res;
|
|
|
}
|
|
|
|