|
@@ -4,6 +4,7 @@ const _ = require('lodash'); |
|
@@ -4,6 +4,7 @@ const _ = require('lodash'); |
4
|
const cookie = global.yoho.cookie;
|
4
|
const cookie = global.yoho.cookie;
|
5
|
const authcode = require('../../utils/authcode');
|
5
|
const authcode = require('../../utils/authcode');
|
6
|
const config = global.yoho.config;
|
6
|
const config = global.yoho.config;
|
|
|
7
|
+const logger = global.yoho.logger;
|
7
|
|
8
|
|
8
|
module.exports = () => {
|
9
|
module.exports = () => {
|
9
|
return (req, res, next) => {
|
10
|
return (req, res, next) => {
|
|
@@ -69,6 +70,10 @@ module.exports = () => { |
|
@@ -69,6 +70,10 @@ module.exports = () => { |
69
|
let appVersion = req.query.app_version || req.cookies.app_version || config.appVersion;
|
70
|
let appVersion = req.query.app_version || req.cookies.app_version || config.appVersion;
|
70
|
let appSessionType = req.query.client_type || req.cookies.app_client_type;
|
71
|
let appSessionType = req.query.client_type || req.cookies.app_client_type;
|
71
|
|
72
|
|
|
|
73
|
+ if (req.query.app_version && req.query.client_type) {
|
|
|
74
|
+ logger.warn(`app session from querystring, url:${req.url}`);
|
|
|
75
|
+ }
|
|
|
76
|
+
|
72
|
req.query.uid = {
|
77
|
req.query.uid = {
|
73
|
toString: () => {
|
78
|
toString: () => {
|
74
|
return _.parseInt(appUid);
|
79
|
return _.parseInt(appUid);
|
|
@@ -76,9 +81,11 @@ module.exports = () => { |
|
@@ -76,9 +81,11 @@ module.exports = () => { |
76
|
appVersion: appVersion,
|
81
|
appVersion: appVersion,
|
77
|
appSessionType: appSessionType
|
82
|
appSessionType: appSessionType
|
78
|
};
|
83
|
};
|
79
|
- res.cookie('app_uid', appUid.toString());
|
|
|
80
|
- res.cookie('app_version', appVersion);
|
|
|
81
|
- res.cookie('app_client_type', appSessionType);
|
84
|
+
|
|
|
85
|
+ // 此处 cookie 为了 pagecache 放到前端去写
|
|
|
86
|
+ // res.cookie('app_uid', appUid.toString());
|
|
|
87
|
+ // res.cookie('app_version', appVersion);
|
|
|
88
|
+ // res.cookie('app_client_type', appSessionType);
|
82
|
}
|
89
|
}
|
83
|
}
|
90
|
}
|
84
|
|
91
|
|