Authored by 周少峰

Merge branch 'release/hbs' of git.yoho.cn:fe/yohobuy-node into release/hbs

... ... @@ -53,7 +53,7 @@ function doPassportCallback(req, res, user) {
refer: refer
});
} else if (result.data['is_bind'] === 'Y' && result.data.uid) {//eslint-disable-line
return loginService.syncUserSession(result.data.uid, result.data.session_key, req, res).then(() => {
return loginService.syncUserSession(result.data.uid, req, res, result.data.session_key).then(() => {
return refer;
});
}
... ... @@ -178,7 +178,7 @@ const local = {
}
}());
loginService.syncUserSession(user.uid, user.session_key, req, res).then(() => {
loginService.syncUserSession(user.uid, req, res, user.session_key).then(() => {
return res.json({
code: 200,
data: {
... ...
... ... @@ -24,10 +24,12 @@ const signin = (type, area, profile, password, shoppingKey) => {
return loginBy[type](area, profile, password, shoppingKey);
};
const syncUserSession = (uid, sessionKey, req, res) => {
cache.set(`java_session_key:${uid}`, sessionKey).catch(() => {
global.yoho.logger.error('write session key fail');
});
const syncUserSession = (uid, req, res, sessionKey) => {
if (sessionKey) {
cache.set(`java_session_key:${uid}`, sessionKey).catch(() => {
global.yoho.logger.error('write session key fail');
});
}
return Promise.all([userService.profile(uid), cartService.goodsCount(uid)]).spread((userInfo, count) => {
let token = sign.makeToken(uid);
... ...
... ... @@ -24,7 +24,7 @@ module.exports = () => {
});
res.removeHeader('Pragma');
res.removeHeader('Expires');
} else if (req.get('X-Requested-With') === 'XMLHttpRequest') {
} else if (req.xhr) {
res.set('Cache-Control', 'no-cache');
} else {
res.set({
... ...
... ... @@ -63,7 +63,7 @@
"uuid": "^2.0.2",
"winston": "^2.2.0",
"winston-daily-rotate-file": "^1.1.4",
"yoho-node-lib": "0.1.26",
"yoho-node-lib": "0.1.27",
"yoho-zookeeper": "^1.0.3"
},
"devDependencies": {
... ...