Authored by 陈峰

携带sessionkey

... ... @@ -264,7 +264,7 @@ const local = {
code: 200,
data: user
});
});
}).catch(next);
}
})(req, res, next);
},
... ...
... ... @@ -64,11 +64,19 @@ class Auth {
static syncUserSession(uid, req, res, sessionKey) {
if (sessionKey) {
global.yoho.cache.set(`java_session_key:${uid}`, sessionKey).catch(() => {
global.yoho.logger.error('write session key fail');
});
// 弃用
// global.yoho.cache.set(`java_session_key:${uid}`, sessionKey).catch(() => {
// global.yoho.logger.error('write session key fail');
// });
req.session.SESSION_KEY = sessionKey;
req.user.uid = {
toString: () => {
return uid;
},
sessionKey
};
}
return Auth.profile(uid).then((userInfo) => {
return Auth.profile(req.user.uid).then((userInfo) => {
let salt = uuid.v4().substr(0, 8);
let saltedUid = uid + salt;
... ...
... ... @@ -10,13 +10,11 @@ const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test';
const domains = {
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test3.yohops.com:9999/',
// api: 'http://dev-api.yohops.com:9999/',
// service: 'http://dev-service.yohops.com:9999/',
api: 'http://dev-api.yohops.com:9999/',
service: 'http://dev-service.yohops.com:9999/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/',
... ... @@ -27,7 +25,7 @@ const domains = {
module.exports = {
app: 'h5',
appVersion: '5.4.1', // 调用api的版本
appVersion: '5.5.1', // 调用api的版本
port: 6001,
siteUrl: '//m.yohobuy.com',
assetUrl: '//127.0.0.1:5001',
... ...
... ... @@ -12,7 +12,7 @@ module.exports = () => {
toString: () => {
return req.session.LOGIN_UID;
},
sessionId: req.cookies._session
sessionKey: req.session.SESSION_KEY
};
let userData = _.get(req.session, 'USER', {});
... ... @@ -26,7 +26,7 @@ module.exports = () => {
toString: () => {
return cookie.getUid(req);
},
sessionId: req.cookies._session
sessionKey: req.session.SESSION_KEY
};
}
... ...