Authored by 周少峰

Merge branch 'master' into feature/qps

@@ -150,5 +150,5 @@ library @@ -150,5 +150,5 @@ library
150 ### foreman ### 150 ### foreman ###
151 Procfile 151 Procfile
152 .env 152 .env
153 -.package-lock  
154 -package-lock.json 153 +yarn.lock
  154 +package-json.lock
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 const robotCheckService = require('../models/robot-check-service'); 3 const robotCheckService = require('../models/robot-check-service');
4 const captchaService = require('../../passport/controllers/captcha'); 4 const captchaService = require('../../passport/controllers/captcha');
5 - 5 +const logger = global.yoho.logger;
6 const index = (req, res, next) => { 6 const index = (req, res, next) => {
7 let channel = req.yoho.channel || 'boys'; 7 let channel = req.yoho.channel || 'boys';
8 8
@@ -27,6 +27,7 @@ const isHuman = (req, res) => { @@ -27,6 +27,7 @@ const isHuman = (req, res) => {
27 remoteIp = arr[0]; 27 remoteIp = arr[0];
28 } 28 }
29 29
  30 + logger.info('isHuman', remoteIp);
30 robotCheckService.removeBlack(remoteIp).then(() => { 31 robotCheckService.removeBlack(remoteIp).then(() => {
31 return res.json({ 32 return res.json({
32 code: 200 33 code: 200
@@ -49,7 +49,15 @@ const generate = (req, res, next) => { @@ -49,7 +49,15 @@ const generate = (req, res, next) => {
49 49
50 res.type('png'); 50 res.type('png');
51 if (result.code === 200) { 51 if (result.code === 200) {
52 - request(result.data.url).pipe(res); 52 + request({
  53 + url: result.data.url,
  54 + headers: {
  55 + 'X-request-ID': req.reqID || '',
  56 + 'X-YOHO-IP': req.yoho.clientIp || '',
  57 + 'X-Forwarded-For': req.yoho.clientIp || '',
  58 + 'User-Agent': 'yoho/nodejs'
  59 + }
  60 + }).pipe(res);
53 } 61 }
54 62
55 }).catch(next); 63 }).catch(next);
@@ -172,7 +172,7 @@ module.exports = { @@ -172,7 +172,7 @@ module.exports = {
172 }, 172 },
173 REQUEST_LIMIT: { 173 REQUEST_LIMIT: {
174 // 10s 最多访问5次 174 // 10s 最多访问5次
175 - 10: 8, 175 + 10: 10,
176 176
177 // 30s 最多访问15次 177 // 30s 最多访问15次
178 30: 20, 178 30: 20,
1 { 1 {
2 "name": "yohobuy-node", 2 "name": "yohobuy-node",
3 - "version": "5.9.92", 3 + "version": "6.1.8",
4 "private": true, 4 "private": true,
5 "description": "A New Yohobuy Project With Express", 5 "description": "A New Yohobuy Project With Express",
6 "repository": { 6 "repository": {
@@ -57,7 +57,7 @@ @@ -57,7 +57,7 @@
57 "urlencode": "^1.1.0", 57 "urlencode": "^1.1.0",
58 "uuid": "^2.0.2", 58 "uuid": "^2.0.2",
59 "yoho-express-session": "^2.0.0", 59 "yoho-express-session": "^2.0.0",
60 - "yoho-node-lib": "^0.5.12", 60 + "yoho-node-lib": "=0.5.12",
61 "yoho-zookeeper": "^1.0.8" 61 "yoho-zookeeper": "^1.0.8"
62 }, 62 },
63 "devDependencies": { 63 "devDependencies": {
@@ -19,6 +19,7 @@ var setPager = require('./detail/pager'); @@ -19,6 +19,7 @@ var setPager = require('./detail/pager');
19 var notify = require('./detail/notify'); 19 var notify = require('./detail/notify');
20 var favorite = require('./detail/brand-fav'); 20 var favorite = require('./detail/brand-fav');
21 var intro = require('./detail/intro'); 21 var intro = require('./detail/intro');
  22 +var changeNav = require('./detail/change-nav');
22 23
23 var bindEvent = $.Callbacks(); // eslint-disable-line 24 var bindEvent = $.Callbacks(); // eslint-disable-line
24 var cartEvent = new EventProxy(); 25 var cartEvent = new EventProxy();
@@ -2012,6 +2013,9 @@ $(function() { @@ -2012,6 +2013,9 @@ $(function() {
2012 shownum: 5, 2013 shownum: 5,
2013 isCircle: true 2014 isCircle: true
2014 }); 2015 });
  2016 +
  2017 + // 修改导航
  2018 + changeNav();
2015 }); 2019 });
2016 2020
2017 yasAtBottom.yasBottom(); 2021 yasAtBottom.yasBottom();
  1 +var $ = require('yoho-jquery');
  2 +
  3 +module.exports = function() {
  4 + var _channel = { // eslint-disable-line
  5 + boys: {
  6 + url: '//www.yohobuy.com',
  7 + name: 'BOYS首页'
  8 + },
  9 + girls: {
  10 + url: '//new.yohobuy.com/woman',
  11 + name: 'GIRLS首页'
  12 + },
  13 + kids: {
  14 + url: '//new.yohobuy.com/kids',
  15 + name: 'KIDS首页'
  16 + },
  17 + lifestyle: {
  18 + url: '//new.yohobuy.com/lifestyle',
  19 + name: 'LIFESTYLE首页'
  20 + }
  21 + };
  22 +
  23 + var current = _channel[window.cookie('_Channel')] || _channel.boys; // eslint-disable-line
  24 +
  25 + $('.path-nav > a').first()
  26 + .attr('href', current.url)
  27 + .text(current.name);
  28 +};