Authored by 毕凯

完善 udid

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