Authored by 郭成尧

signinByOpenID-business_line

... ... @@ -25,6 +25,7 @@ const loginPage = `${config.siteUrl}/signin.html`;
function doPassportCallback(openId, nickname, sourceType, req, res) {
let shoppingKey = cookie.getShoppingKey(req);
let refer = req.cookies.refer;
let from = req.cookies.from || 'yohobuy';
if (refer) {
refer = decodeURI(req.cookies.refer);
... ... @@ -39,7 +40,9 @@ function doPassportCallback(openId, nickname, sourceType, req, res) {
refer = utils.refererLimit(refer);
if (openId && nickname) {
return req.ctx(AuthHelperModel).signinByOpenID(nickname, openId, sourceType, shoppingKey).then((result) => {
return req.ctx(AuthHelperModel).signinByOpenID({
nickname, openId, sourceType, shoppingKey, from
}).then((result) => {
if (result.code !== 200) {
return Promise.reject(result);
}
... ...
... ... @@ -58,17 +58,17 @@ class AuthModel extends global.yoho.BaseModel {
});
}
signinByOpenID(nickname, openId, sourceType, shoppingKey) {
signinByOpenID(params) {
let param = {
nickname: nickname,
openId: openId,
source_type: sourceType, // esline-disable-line
nickname: params.nickname,
openId: params.openId,
source_type: params.sourceType, // esline-disable-line
method: 'app.passport.signinByOpenID',
shoppingKey: shoppingKey
business_line: FROM[params.from].business_line
};
if (shoppingKey) {
param.shopping_key = shoppingKey;
if (params.shoppingKey) {
param.shopping_key = params.shoppingKey;
}
return api.get('', param);
... ...