...
|
...
|
@@ -27,18 +27,20 @@ function doPassportCallback(openId, nickname, req, res) { |
|
|
if (openId && nickname) {
|
|
|
AuthHelper.signinByOpenID(nickname, openId, 'wechat', shoppingKey).then((result) => {
|
|
|
if (result.data['is_bind'] && result.data['is_bind'] === 'N') { //eslint-disable-line
|
|
|
res.redirect(helpers.urlFormat('/passport/bind/index', {
|
|
|
return helpers.urlFormat('/passport/bind/index', {
|
|
|
openId: openId,
|
|
|
sourceType: 'wechat'
|
|
|
}));
|
|
|
});
|
|
|
} else if (result.code === 200 && result.data.uid) {
|
|
|
return AuthHelper.syncUserSession(result.data.uid, res);
|
|
|
return AuthHelper.syncUserSession(result.data.uid, res).then(() => {
|
|
|
return refer;
|
|
|
});
|
|
|
}
|
|
|
}).then(() => {
|
|
|
res.redirect(refer);
|
|
|
}).then((redirectTo) => {
|
|
|
return res.redirect(redirectTo);
|
|
|
}).catch((e) => {
|
|
|
log.error('频道页面渲染错误:' + JSON.stringify(e));
|
|
|
res.send('error');
|
|
|
return res.send('error');
|
|
|
});
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -58,7 +60,6 @@ const wechat = { |
|
|
if (err) {
|
|
|
return next(err);
|
|
|
}
|
|
|
console.log(user);
|
|
|
let nickname = user.displayName || user._json.nickname;
|
|
|
let openId = user.id || user._json.unionid;
|
|
|
|
...
|
...
|
@@ -67,4 +68,4 @@ const wechat = { |
|
|
}
|
|
|
};
|
|
|
|
|
|
exports.wechat = wechat; |
|
|
exports.wechat = wechat; |
|
|
\ No newline at end of file |
...
|
...
|
|