Showing
1 changed file
with
9 additions
and
0 deletions
@@ -21,6 +21,7 @@ const compression = require('compression'); | @@ -21,6 +21,7 @@ const compression = require('compression'); | ||
21 | const bodyParser = require('body-parser'); | 21 | const bodyParser = require('body-parser'); |
22 | const cookieParser = require('cookie-parser'); | 22 | const cookieParser = require('cookie-parser'); |
23 | const moment = require('moment'); | 23 | const moment = require('moment'); |
24 | +const uuid = require('uuid'); | ||
24 | 25 | ||
25 | const pkg = require('./package.json'); | 26 | const pkg = require('./package.json'); |
26 | const hbsEvent = require('./config/hbsevent'); | 27 | const hbsEvent = require('./config/hbsevent'); |
@@ -113,6 +114,14 @@ app.use((req, res, next) => { | @@ -113,6 +114,14 @@ app.use((req, res, next) => { | ||
113 | req.app.locals.wap = app.locals.wap; // zookeper对象赋值 | 114 | req.app.locals.wap = app.locals.wap; // zookeper对象赋值 |
114 | 115 | ||
115 | req.isApmReport = app.locals.wap.open && app.locals.wap.open.bughd; // 把错误上报的开关绑定到上下文,node-lib 库要使用 | 116 | req.isApmReport = app.locals.wap.open && app.locals.wap.open.bughd; // 把错误上报的开关绑定到上下文,node-lib 库要使用 |
117 | + | ||
118 | + // 独立的 UDID | ||
119 | + if (!req.cookies.UDID) { | ||
120 | + res.cookie('UDID', uuid.v4(), { | ||
121 | + domain: 'yohobuy.com', | ||
122 | + expires: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000) | ||
123 | + }); | ||
124 | + } | ||
116 | next(); | 125 | next(); |
117 | }); | 126 | }); |
118 | 127 |
-
Please register or login to post a comment