Authored by 毕凯

完善 udid

Showing 1 changed file with 4 additions and 1 deletions
@@ -115,12 +115,15 @@ app.use((req, res, next) => { @@ -115,12 +115,15 @@ app.use((req, res, next) => {
115 req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等 115 req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等
116 req.app.locals.wap = app.locals.wap; // zookeper对象赋值 116 req.app.locals.wap = app.locals.wap; // zookeper对象赋值
117 117
  118 + const udid = uuid.v4();
  119 +
118 // 独立的 UDID 120 // 独立的 UDID
119 if (!req.cookies.udid) { 121 if (!req.cookies.udid) {
120 - res.cookie('udid', uuid.v4(), { 122 + res.cookie('udid', udid, {
121 domain: 'yohobuy.com', 123 domain: 'yohobuy.com',
122 expires: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000) 124 expires: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000)
123 }); 125 });
  126 + req.cookies.udid = udid;
124 } 127 }
125 next(); 128 next();
126 }); 129 });