Authored by 刘传洋

merge hotfix

@@ -7,11 +7,6 @@ @@ -7,11 +7,6 @@
7 7
8 const config = require('./config/common'); 8 const config = require('./config/common');
9 9
10 -// use one apm  
11 -if (config.useOneapm) {  
12 - require('oneapm');  
13 -}  
14 -  
15 const express = require('express'); 10 const express = require('express');
16 const path = require('path'); 11 const path = require('path');
17 const bodyParser = require('body-parser'); 12 const bodyParser = require('body-parser');
@@ -42,6 +37,7 @@ app.locals.version = pkg.version; @@ -42,6 +37,7 @@ app.locals.version = pkg.version;
42 app.set('subdomain offset', 2); 37 app.set('subdomain offset', 2);
43 app.set('view engine', '.hbs'); 38 app.set('view engine', '.hbs');
44 app.set('views', './doraemon/views'); 39 app.set('views', './doraemon/views');
  40 +app.set('view cache', true);
45 app.engine('.hbs', hbs({ 41 app.engine('.hbs', hbs({
46 extname: '.hbs', 42 extname: '.hbs',
47 defaultLayout: 'layout', 43 defaultLayout: 'layout',
@@ -70,7 +66,12 @@ app.use(session({ @@ -70,7 +66,12 @@ app.use(session({
70 66
71 store: new MemcachedStore({ 67 store: new MemcachedStore({
72 hosts: config.memcache.session, 68 hosts: config.memcache.session,
73 - prefix: 'yohobuy_session:' 69 + prefix: 'yohobuy_session:',
  70 + poolSize: 25,
  71 + reconnect: 5000,
  72 + timeout: 1000,
  73 + retries: 1,
  74 + retry: 3000
74 }) 75 })
75 })); 76 }));
76 77
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 */ 6 */
7 7
8 'use strict'; 8 'use strict';
9 -const utils = '../../../utils';  
10 const api = global.yoho.API; 9 const api = global.yoho.API;
11 const Promise = require('bluebird'); 10 const Promise = require('bluebird');
12 const saleApi = require('./sale-api'); 11 const saleApi = require('./sale-api');
@@ -383,13 +382,20 @@ exports.getSaleDiscountData = (params, channel) => { @@ -383,13 +382,20 @@ exports.getSaleDiscountData = (params, channel) => {
383 382
384 // 处理商品数据,顶部分类 383 // 处理商品数据,顶部分类
385 if (subResult[1].code === 200) { 384 if (subResult[1].code === 200) {
  385 + let sknArr = [];
  386 +
386 finalResult.saleList.goods = productProcess.processProductList(subResult[1].data.product_list); 387 finalResult.saleList.goods = productProcess.processProductList(subResult[1].data.product_list);
387 finalResult.saleList.totalCount = subResult[1].data.total; 388 finalResult.saleList.totalCount = subResult[1].data.total;
388 _.forEach(finalResult.saleList.goods, (value, key) => { 389 _.forEach(finalResult.saleList.goods, (value, key) => {
  390 + if (sknArr.length < 3) {
  391 + sknArr.push(value.product_skn);
  392 + }
389 delete finalResult.saleList.goods[key].tags.is_new; // 屏蔽 new 标签 393 delete finalResult.saleList.goods[key].tags.is_new; // 屏蔽 new 标签
390 delete finalResult.saleList.goods[key].tags.is_sale;// 屏蔽 sale 标签 394 delete finalResult.saleList.goods[key].tags.is_sale;// 屏蔽 sale 标签
391 delete finalResult.saleList.goods[key].discount; // 屏蔽折扣信息 395 delete finalResult.saleList.goods[key].discount; // 屏蔽折扣信息
392 }); 396 });
  397 +
  398 + finalResult.criteo = {skn: sknArr}; // 重要:推广列表前三个商品Skn
393 } 399 }
394 400
395 return finalResult; 401 return finalResult;
@@ -11,4 +11,5 @@ @@ -11,4 +11,5 @@
11 {{/ saleList}} 11 {{/ saleList}}
12 </div> 12 </div>
13 </div> 13 </div>
  14 +{{> common/criteo}}
14 {{/ result}} 15 {{/ result}}
  1 +{{# criteo}}
  2 + <script type="text/javascript" src="//static.criteo.net/js/ld/ld.js" async="true"></script>
  3 + <script type="text/javascript">
  4 + window.criteo_q = window.criteo_q || [];
  5 + window.criteo_q.push(
  6 + { event: "setAccount", account: [16184] },
  7 + { event: "setSiteType", type: "d" },
  8 + { event: "viewList", item: [{{#each skn}}"{{.}}"{{#unless @last}},{{/unless}}{{/each}}]}
  9 + );
  10 + </script>
  11 +{{/ criteo}}
@@ -87,12 +87,16 @@ if (isProduction) { @@ -87,12 +87,16 @@ if (isProduction) {
87 master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'], 87 master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
88 slave: ['memcache1.yohoops.org:12112', 'memcache2.yohoops.org:12112', 'memcache3.yohoops.org:12112'], 88 slave: ['memcache1.yohoops.org:12112', 'memcache2.yohoops.org:12112', 'memcache3.yohoops.org:12112'],
89 session: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'], 89 session: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
90 - timeout: 3000 90 + poolSize: 25,
  91 + reconnect: 5000,
  92 + timeout: 300,
  93 + retries: 1,
  94 + retry: 3000
91 }, 95 },
92 useOneapm: true, 96 useOneapm: true,
93 useCache: true, 97 useCache: true,
94 interfaceShunt: { 98 interfaceShunt: {
95 - open: false, 99 + open: true,
96 url: 'http://123.206.2.55/strategy' 100 url: 'http://123.206.2.55/strategy'
97 } 101 }
98 }); 102 });
@@ -25,4 +25,27 @@ var _gaq = _gaq || []; @@ -25,4 +25,27 @@ var _gaq = _gaq || [];
25 window.attachEvent('onload', async_load); 25 window.attachEvent('onload', async_load);
26 } 26 }
27 })(); 27 })();
  28 +</script>
  29 +<script>
  30 + window._py = window._py||[];
  31 + window._py.push(['a', 'MC..o8vMMWxEXDCiqYckD81lUX']);
  32 + window._py.push(['domain','stats.ipinyou.com']);
  33 + window._py.push(['e','']);
  34 + if(typeof _goodsData!='undefined'){
  35 + window._py.push(['pi',_goodsData]);
  36 + }
  37 + -function(d){
  38 + var f = 'https:' == d.location.protocol;var c = d.createElement('script');c.type='text/javascript';c.async=1;
  39 + c.src=(f ? 'https' : 'http') + '://'+(f?'fm.ipinyou.com':'fm.p0y.cn')+'/j/t/adv.js';
  40 + var h = d.getElementsByTagName("script")[0];h.parentNode.insertBefore(c, h);
  41 + }(document);
  42 +</script>
  43 +<script>
  44 + var _hmt = _hmt || [];
  45 + (function() {
  46 + var hm = document.createElement("script");
  47 + hm.src = "//hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
  48 + var s = document.getElementsByTagName("script")[0];
  49 + s.parentNode.insertBefore(hm, s);
  50 + })();
28 </script> 51 </script>