Authored by 郭成尧

UDID

Showing 1 changed file with 9 additions and 0 deletions
... ... @@ -21,6 +21,7 @@ const compression = require('compression');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const moment = require('moment');
const uuid = require('uuid');
const pkg = require('./package.json');
const hbsEvent = require('./config/hbsevent');
... ... @@ -113,6 +114,14 @@ app.use((req, res, next) => {
req.app.locals.wap = app.locals.wap; // zookeper对象赋值
req.isApmReport = app.locals.wap.open && app.locals.wap.open.bughd; // 把错误上报的开关绑定到上下文,node-lib 库要使用
// 独立的 UDID
if (!req.cookies.UDID) {
res.cookie('UDID', uuid.v4(), {
domain: 'yohobuy.com',
expires: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000)
});
}
next();
});
... ...