...
|
...
|
@@ -7,7 +7,6 @@ const config = global.yoho.config; |
|
|
|
|
|
module.exports = () => {
|
|
|
return (req, res, next) => {
|
|
|
|
|
|
if (!req.yoho.isApp) {
|
|
|
// 从 SESSION 中获取到当前登录用户的 UID
|
|
|
if (req.session && _.isNumber(req.session.LOGIN_UID_)) {
|
...
|
...
|
@@ -39,9 +38,11 @@ module.exports = () => { |
|
|
};
|
|
|
}
|
|
|
} else {
|
|
|
let params = req.method === 'POST' ? req.body : req.query;
|
|
|
|
|
|
if (!req.user.uid &&
|
|
|
(
|
|
|
(req.query.uid && req.query.uid !== '0') ||
|
|
|
(params.uid && params.uid !== '0') ||
|
|
|
(
|
|
|
req.cookies.app_uid &&
|
|
|
req.cookies.app_uid !== '0' &&
|
...
|
...
|
@@ -50,12 +51,12 @@ module.exports = () => { |
|
|
)
|
|
|
)
|
|
|
) {
|
|
|
let appUid = req.query.uid || req.cookies.app_uid;
|
|
|
let appVersion = req.query.app_version || req.cookies.app_version || config.appVersion;
|
|
|
let appSessionType = req.query.client_type || req.cookies.app_client_type;
|
|
|
let sessionKey = req.query.session_key || req.cookies.app_session_key;
|
|
|
let appUid = params.uid || req.cookies.app_uid;
|
|
|
let appVersion = params.app_version || req.cookies.app_version || config.appVersion;
|
|
|
let appSessionType = params.client_type || req.cookies.app_client_type;
|
|
|
let sessionKey = params.session_key || req.cookies.app_session_key;
|
|
|
|
|
|
req.user.uid = req.query.uid = {
|
|
|
req.user.uid = params.uid = {
|
|
|
toString: () => {
|
|
|
return _.parseInt(appUid);
|
|
|
},
|
...
|
...
|
@@ -82,7 +83,7 @@ module.exports = () => { |
|
|
return _.parseInt(req.cookies.app_uid);
|
|
|
},
|
|
|
sessionKey: req.cookies.app_session_key,
|
|
|
appVersion: req.cookies.app_version || req.query.app_version || config.appVersion,
|
|
|
appVersion: req.cookies.app_version || params.app_version || config.appVersion,
|
|
|
appSessionType: req.cookies.app_client_type
|
|
|
};
|
|
|
}
|
...
|
...
|
|