|
@@ -2,7 +2,21 @@ const _ = require('lodash'); |
|
@@ -2,7 +2,21 @@ const _ = require('lodash'); |
2
|
const config = global.yoho.config;
|
2
|
const config = global.yoho.config;
|
3
|
|
3
|
|
4
|
module.exports = (req, res, next) => {
|
4
|
module.exports = (req, res, next) => {
|
5
|
- if (!req.user.uid &&
|
5
|
+ if (!req.yoho.isApp) {
|
|
|
6
|
+ if (req.session && _.isNumber(req.session.LOGIN_UID_)) {
|
|
|
7
|
+ // 调用接口传参时切勿使用toString获得字符串
|
|
|
8
|
+ req.user.uid = {
|
|
|
9
|
+ toString: () => {
|
|
|
10
|
+ return _.parseInt(req.session.LOGIN_UID_);
|
|
|
11
|
+ },
|
|
|
12
|
+ sessionKey: req.session.SESSION_KEY,
|
|
|
13
|
+ appSessionType: req.session.SESSION_TYPE
|
|
|
14
|
+ };
|
|
|
15
|
+ let userData = _.get(req.session, 'USER', {});
|
|
|
16
|
+
|
|
|
17
|
+ _.merge(req.user, userData);
|
|
|
18
|
+ }
|
|
|
19
|
+ } else if (!req.user.uid &&
|
6
|
req.cookies.app_uid &&
|
20
|
req.cookies.app_uid &&
|
7
|
req.cookies.app_uid !== '0' &&
|
21
|
req.cookies.app_uid !== '0' &&
|
8
|
req.cookies.app_session_key &&
|
22
|
req.cookies.app_session_key &&
|