...
|
...
|
@@ -4,6 +4,7 @@ const _ = require('lodash'); |
|
|
const cookie = global.yoho.cookie;
|
|
|
const authcode = require('../../utils/authcode');
|
|
|
const config = global.yoho.config;
|
|
|
const logger = global.yoho.logger;
|
|
|
|
|
|
module.exports = () => {
|
|
|
return (req, res, next) => {
|
...
|
...
|
@@ -69,6 +70,10 @@ module.exports = () => { |
|
|
let appVersion = req.query.app_version || req.cookies.app_version || config.appVersion;
|
|
|
let appSessionType = req.query.client_type || req.cookies.app_client_type;
|
|
|
|
|
|
if (req.query.app_version && req.query.client_type) {
|
|
|
logger.warn(`app session from querystring, url:${req.url}`);
|
|
|
}
|
|
|
|
|
|
req.query.uid = {
|
|
|
toString: () => {
|
|
|
return _.parseInt(appUid);
|
...
|
...
|
@@ -76,9 +81,11 @@ module.exports = () => { |
|
|
appVersion: appVersion,
|
|
|
appSessionType: appSessionType
|
|
|
};
|
|
|
res.cookie('app_uid', appUid.toString());
|
|
|
res.cookie('app_version', appVersion);
|
|
|
res.cookie('app_client_type', appSessionType);
|
|
|
|
|
|
// 此处 cookie 为了 pagecache 放到前端去写
|
|
|
// res.cookie('app_uid', appUid.toString());
|
|
|
// res.cookie('app_version', appVersion);
|
|
|
// res.cookie('app_client_type', appSessionType);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|