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