Authored by ccbikai

修改微信错误处理方法

... ... @@ -30,7 +30,7 @@ function doPassportCallback(openId, nickname, sourceType, req, res) {
refer = `${config.siteUrl}/home`;
}
if (openId && nickname) {
AuthHelper.signinByOpenID(nickname, openId, sourceType, shoppingKey).then((result) => {
return AuthHelper.signinByOpenID(nickname, openId, sourceType, shoppingKey).then((result) => {
if (result.data['is_bind'] && result.data['is_bind'] === 'N') { //eslint-disable-line
return helpers.urlFormat('/passport/bind/index', {
openId: openId,
... ... @@ -44,9 +44,6 @@ function doPassportCallback(openId, nickname, sourceType, req, res) {
}
}).then((redirectTo) => {
return res.redirect(redirectTo);
}).catch((e) => {
log.error('频道页面渲染错误:' + JSON.stringify(e));
return res.send('error');
});
}
}
... ... @@ -77,7 +74,7 @@ const wechat = {
let nickname = user._json.nickname || user.displayName;
let openId = user._json.unionid || user.id;
doPassportCallback(openId, nickname, 'wechat', req, res);
doPassportCallback(openId, nickname, 'wechat', req, res).catch(next);
})(req, res, next);
}
};
... ...
... ... @@ -49,7 +49,7 @@ class Auth {
res.cookie('_TOKEN', token, {
domain: 'yohobuy.com'
}); // esline-disable-line
}).catch(console.log);
});
}
}
... ...