Authored by 陈峰

携带sessionkey

@@ -264,7 +264,7 @@ const local = { @@ -264,7 +264,7 @@ const local = {
264 code: 200, 264 code: 200,
265 data: user 265 data: user
266 }); 266 });
267 - }); 267 + }).catch(next);
268 } 268 }
269 })(req, res, next); 269 })(req, res, next);
270 }, 270 },
@@ -64,11 +64,19 @@ class Auth { @@ -64,11 +64,19 @@ class Auth {
64 64
65 static syncUserSession(uid, req, res, sessionKey) { 65 static syncUserSession(uid, req, res, sessionKey) {
66 if (sessionKey) { 66 if (sessionKey) {
67 - global.yoho.cache.set(`java_session_key:${uid}`, sessionKey).catch(() => {  
68 - global.yoho.logger.error('write session key fail');  
69 - }); 67 + // 弃用
  68 + // global.yoho.cache.set(`java_session_key:${uid}`, sessionKey).catch(() => {
  69 + // global.yoho.logger.error('write session key fail');
  70 + // });
  71 + req.session.SESSION_KEY = sessionKey;
  72 + req.user.uid = {
  73 + toString: () => {
  74 + return uid;
  75 + },
  76 + sessionKey
  77 + };
70 } 78 }
71 - return Auth.profile(uid).then((userInfo) => { 79 + return Auth.profile(req.user.uid).then((userInfo) => {
72 let salt = uuid.v4().substr(0, 8); 80 let salt = uuid.v4().substr(0, 8);
73 let saltedUid = uid + salt; 81 let saltedUid = uid + salt;
74 82
@@ -10,13 +10,11 @@ const isProduction = process.env.NODE_ENV === 'production'; @@ -10,13 +10,11 @@ const isProduction = process.env.NODE_ENV === 'production';
10 const isTest = process.env.NODE_ENV === 'test'; 10 const isTest = process.env.NODE_ENV === 'test';
11 11
12 const domains = { 12 const domains = {
13 - api: 'http://api.yoho.cn/',  
14 - service: 'http://service.yoho.cn/',  
15 liveApi: 'http://testapi.live.yohops.com:9999/', 13 liveApi: 'http://testapi.live.yohops.com:9999/',
16 singleApi: 'http://api-test3.yohops.com:9999/', 14 singleApi: 'http://api-test3.yohops.com:9999/',
17 15
18 - // api: 'http://dev-api.yohops.com:9999/',  
19 - // service: 'http://dev-service.yohops.com:9999/', 16 + api: 'http://dev-api.yohops.com:9999/',
  17 + service: 'http://dev-service.yohops.com:9999/',
20 // liveApi: 'http://api.live.yoho.cn/', 18 // liveApi: 'http://api.live.yoho.cn/',
21 // singleApi: 'http://single.yoho.cn/', 19 // singleApi: 'http://single.yoho.cn/',
22 20
@@ -27,7 +25,7 @@ const domains = { @@ -27,7 +25,7 @@ const domains = {
27 25
28 module.exports = { 26 module.exports = {
29 app: 'h5', 27 app: 'h5',
30 - appVersion: '5.4.1', // 调用api的版本 28 + appVersion: '5.5.1', // 调用api的版本
31 port: 6001, 29 port: 6001,
32 siteUrl: '//m.yohobuy.com', 30 siteUrl: '//m.yohobuy.com',
33 assetUrl: '//127.0.0.1:5001', 31 assetUrl: '//127.0.0.1:5001',
@@ -12,7 +12,7 @@ module.exports = () => { @@ -12,7 +12,7 @@ module.exports = () => {
12 toString: () => { 12 toString: () => {
13 return req.session.LOGIN_UID; 13 return req.session.LOGIN_UID;
14 }, 14 },
15 - sessionId: req.cookies._session 15 + sessionKey: req.session.SESSION_KEY
16 }; 16 };
17 let userData = _.get(req.session, 'USER', {}); 17 let userData = _.get(req.session, 'USER', {});
18 18
@@ -26,7 +26,7 @@ module.exports = () => { @@ -26,7 +26,7 @@ module.exports = () => {
26 toString: () => { 26 toString: () => {
27 return cookie.getUid(req); 27 return cookie.getUid(req);
28 }, 28 },
29 - sessionId: req.cookies._session 29 + sessionKey: req.session.SESSION_KEY
30 }; 30 };
31 } 31 }
32 32