Authored by TaoHuang

fix report

... ... @@ -42,6 +42,10 @@ function getUdid() {
return cookie.get('udid') || '';
}
function getSrc() {
return cookie.get('SRC_ID') || '';
}
function getUid() {
return (cookie.get('_UID') || '').split('::')[1] || '';
}
... ... @@ -82,7 +86,8 @@ function initBaseLogs() {
},
events: [{
sid: '',
uid: getUid()
uid: getUid(),
SRC_ID: getSrc()
}]
};
}
... ...
... ... @@ -107,6 +107,8 @@ const getCacheKey = (req, route) => {
return md5(ck);
};
const ThreeDays = 3 * 24 * 60 * 60 * 1000;
const render = (route) => {
return async(req, res, next) => {
try {
... ... @@ -122,6 +124,15 @@ const render = (route) => {
});
}
res.setHeader('X-YOHO-Version', pkg.version);
if (req.query && req.query.SRC_ID) {
res.cookie('SRC_ID', req.query.SRC_ID, {
domain: 'yohobuy.com',
path: '/',
maxAge: ThreeDays
});
}
const isDegrade = _.get(req.app.locals.wap, 'webapp.degrade', false);
logger.info(`${req.yoho.clientIp} | ${req.url} | uid:${req.user.uid} | ua:${req.get('user-agent')} | ${new Date()}`);
... ... @@ -173,7 +184,6 @@ const render = (route) => {
routeHash: routeEncode.getRouter(req)
});
if (config.useCache && route.cache && ck) {
redis.setex(ck, route.cacheTime || 60, result);
}
... ...