Authored by 毕凯

Merge branch 'hotfix/servererr' of git.yoho.cn:fe/yohobuywap-node into hotfix/servererr

@@ -71,6 +71,14 @@ app.set('json replacer', function(key, value) { @@ -71,6 +71,14 @@ app.set('json replacer', function(key, value) {
71 return value; 71 return value;
72 }); 72 });
73 73
  74 +app.use((req, res, next) => {
  75 + req.isApmReport = _.get(req.app.locals, 'wap.open.bughd', false); // 把错误上报的开关绑定到上下文,node-lib 库要使用
  76 + next();
  77 +});
  78 +
  79 +// 添加请求上下文
  80 +app.use(global.yoho.httpCtx());
  81 +
74 // 请求限制中间件 82 // 请求限制中间件
75 if (!app.locals.devEnv) { 83 if (!app.locals.devEnv) {
76 app.use(require('./doraemon/middleware/limiter')); 84 app.use(require('./doraemon/middleware/limiter'));
@@ -107,8 +115,6 @@ app.use((req, res, next) => { @@ -107,8 +115,6 @@ app.use((req, res, next) => {
107 req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等 115 req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等
108 req.app.locals.wap = app.locals.wap; // zookeper对象赋值 116 req.app.locals.wap = app.locals.wap; // zookeper对象赋值
109 117
110 - req.isApmReport = app.locals.wap.open && app.locals.wap.open.bughd; // 把错误上报的开关绑定到上下文,node-lib 库要使用  
111 -  
112 // 独立的 UDID 118 // 独立的 UDID
113 if (!req.cookies.udid) { 119 if (!req.cookies.udid) {
114 res.cookie('udid', uuid.v4(), { 120 res.cookie('udid', uuid.v4(), {
@@ -294,7 +294,7 @@ const category = (req, res, next) => { @@ -294,7 +294,7 @@ const category = (req, res, next) => {
294 * 品类落地页 SEO 友好的新路由 294 * 品类落地页 SEO 友好的新路由
295 */ 295 */
296 const listNew = (req, res, next) => { 296 const listNew = (req, res, next) => {
297 - req.query = listParamsProcess.getParams(req.url); 297 + req.query = listParamsProcess.getParams(req.path);
298 298
299 if (req.query) { 299 if (req.query) {
300 _.forEach(req.query, (perParam, index) => { 300 _.forEach(req.query, (perParam, index) => {
@@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
73 "xml2js": "^0.4.19", 73 "xml2js": "^0.4.19",
74 "yoho-express-session": "^2.0.0", 74 "yoho-express-session": "^2.0.0",
75 "yoho-md5": "^2.0.0", 75 "yoho-md5": "^2.0.0",
76 - "yoho-node-lib": "=0.5.29", 76 + "yoho-node-lib": "=0.5.31",
77 "yoho-zookeeper": "^1.0.8" 77 "yoho-zookeeper": "^1.0.8"
78 }, 78 },
79 "devDependencies": { 79 "devDependencies": {