...
|
...
|
@@ -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);
|
|
|
}
|
...
|
...
|
|