...
|
...
|
@@ -88,7 +88,7 @@ app.use((req, res, next) => { |
|
|
let isSpider = /spider/i.test(req.get('User-Agent') || '');
|
|
|
|
|
|
if (config.aliasDomains.some(d => d === req.hostname) || isSpider) {
|
|
|
console.log('close session');
|
|
|
// 如果是非m.yohobuy.com域名(无法设置sessionid到cookie域名不同)且是爬虫访问,session降级使用cookiesession
|
|
|
req.session = {
|
|
|
degrage: true
|
|
|
};
|
...
|
...
|
@@ -126,7 +126,6 @@ app.use(compression()); |
|
|
require('./doraemon/middleware/yoho-session')(app);
|
|
|
|
|
|
app.use((req, res, next) => {
|
|
|
console.log(req.session);
|
|
|
req.user = {}; // 全局的用户数据
|
|
|
req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等
|
|
|
req.app.locals.wap = app.locals.wap; // zookeper对象赋值
|
...
|
...
|
|