Authored by htoooth

Merge branch 'feature/seo-product' into release/6.3

@@ -41,7 +41,7 @@ const tdk = require('./utils/getTDK'); @@ -41,7 +41,7 @@ const tdk = require('./utils/getTDK');
41 helpers.image = _.flow(helpers.image, fp.replace(/\/quality\/\d*$/, '/quality/90')); 41 helpers.image = _.flow(helpers.image, fp.replace(/\/quality\/\d*$/, '/quality/90'));
42 42
43 // NOTE:这里修改了参数的个数 43 // NOTE:这里修改了参数的个数
44 -helpers.getUrlBySkc = skn => `//item.yohobuy.com/${skn}.html`; 44 +helpers.getUrlBySkc = skn => `//www.yohobuy.com/product/${skn}.html`;
45 45
46 global.middleware = path.resolve('./doraemon/middleware'); 46 global.middleware = path.resolve('./doraemon/middleware');
47 global.utils = path.resolve('./utils'); 47 global.utils = path.resolve('./utils');
@@ -158,7 +158,7 @@ @@ -158,7 +158,7 @@
158 {{/if_cond}} 158 {{/if_cond}}
159 </td> 159 </td>
160 <td class="border-top color-size"> 160 <td class="border-top color-size">
161 - 颜色:<span class="color">{{color_name}}</span> 161 + 颜色:<span class="color">{{factory_goods_name}}</span>
162 尺码:<span class="size">{{size_name}}</span> 162 尺码:<span class="size">{{size_name}}</span>
163 </td> 163 </td>
164 <td class="border-top price"> 164 <td class="border-top price">
@@ -760,9 +760,11 @@ module.exports = class extends global.yoho.BaseModel { @@ -760,9 +760,11 @@ module.exports = class extends global.yoho.BaseModel {
760 let arr = {}; 760 let arr = {};
761 761
762 for (let it of val.list) { 762 for (let it of val.list) {
  763 + if (it) {
763 productSkn.push(it.id); 764 productSkn.push(it.id);
764 arr[it.id] = it.src; 765 arr[it.id] = it.src;
765 } 766 }
  767 + }
766 768
767 if (productSkn.length) { 769 if (productSkn.length) {
768 // 包含多个对象,每对象里list都取数据,最终每个list只取前4个 770 // 包含多个对象,每对象里list都取数据,最终每个list只取前4个
@@ -909,6 +909,24 @@ function _getIntroInfo(productSkn, maxSortId, additionalData) { @@ -909,6 +909,24 @@ function _getIntroInfo(productSkn, maxSortId, additionalData) {
909 return result; 909 return result;
910 } 910 }
911 911
  912 +function _genderHelper(gender) {
  913 + gender = gender || '';
  914 +
  915 + switch (gender) {
  916 + case '1':
  917 + case '1,3': {
  918 + return '男款';
  919 + }
  920 + case '2':
  921 + case '2,3': {
  922 + return '女款';
  923 + }
  924 + default: {
  925 + return '';
  926 + }
  927 + }
  928 +}
  929 +
912 /** 930 /**
913 * 获取seo信息 931 * 获取seo信息
914 * 932 *
@@ -924,17 +942,28 @@ function _getSeoByGoodsInfo(goodsInfo, navs) { @@ -924,17 +942,28 @@ function _getSeoByGoodsInfo(goodsInfo, navs) {
924 goodsInfo = goodsInfo || {}; 942 goodsInfo = goodsInfo || {};
925 navs = navs || []; 943 navs = navs || [];
926 944
927 - if (goodsInfo.brandName) {  
928 - title = goodsInfo.brandName + ' '; 945 + if (_.get(goodsInfo, 'data.brand_info.brand_name', '')) {
929 brandName = goodsInfo.brandName; 946 brandName = goodsInfo.brandName;
930 } 947 }
931 948
  949 + if (_.get(goodsInfo, 'data.brand_info.brand_name_en')) {
  950 + title += _.get(goodsInfo, 'data.brand_info.brand_name_en') + '|';
  951 + }
  952 +
  953 + if (_.get(goodsInfo, 'data.brand_info.brand_name_cn')) {
  954 + title += _.get(goodsInfo, 'data.brand_info.brand_name_cn') + '|';
  955 + }
  956 +
  957 + if (_.get(goodsInfo, 'data.gender')) {
  958 + title += _genderHelper(_.get(goodsInfo, 'data.gender', '1,3')) + '|';
  959 + }
  960 +
932 if (_.get(navs, '[1].name')) { 961 if (_.get(navs, '[1].name')) {
933 sortName = navs[1].name; 962 sortName = navs[1].name;
934 title += navs[1].name + '|'; 963 title += navs[1].name + '|';
935 } 964 }
936 965
937 - title += goodsInfo.name + '正品 | YOHO!BUY 有货'; 966 + title += _.get(goodsInfo, 'data.product_name') + '正品 | YOHO!BUY 有货';
938 967
939 let keywords = brandName + sortName + ',' + brandName + '专卖店,' + brandName + '官方授权店,' + 968 let keywords = brandName + sortName + ',' + brandName + '专卖店,' + brandName + '官方授权店,' +
940 brandName + '正品,' + brandName + '打折,' + brandName + '折扣店,' + brandName + '真品,' + brandName + '代购'; 969 brandName + '正品,' + brandName + '打折,' + brandName + '折扣店,' + brandName + '真品,' + brandName + '代购';
@@ -1534,7 +1563,7 @@ function showMainAsync(req, data) { @@ -1534,7 +1563,7 @@ function showMainAsync(req, data) {
1534 result.detail.goodsInfo.imageBanner = _getProductActivityBanner(productDescription.banner); 1563 result.detail.goodsInfo.imageBanner = _getProductActivityBanner(productDescription.banner);
1535 1564
1536 // seo 1565 // seo
1537 - result.seo = _getSeoByGoodsInfo(productInfo.goodsInfo, sortNavigator); 1566 + result.seo = _getSeoByGoodsInfo(productData, sortNavigator);
1538 1567
1539 // 商品页面统计 1568 // 商品页面统计
1540 result.statGoodsInfo = Object.assign({fullSortName: sortNavigator.map(x => x.name).join('-')}, 1569 result.statGoodsInfo = Object.assign({fullSortName: sortNavigator.map(x => x.name).join('-')},
@@ -1595,7 +1624,7 @@ function recommendAsync(skn, page, limit) { @@ -1595,7 +1624,7 @@ function recommendAsync(skn, page, limit) {
1595 } 1624 }
1596 1625
1597 const formatPrice = p => ${p}`; 1626 const formatPrice = p => ${p}`;
1598 - const productUrl = (productSkn) => helpers.getUrlBySkc(productSkn); 1627 + const productUrl = helpers.getUrlBySkc;
1599 const productImageUrl = Fn.pipe(Fn.prop('default_images'), _.partial(helpers.image, _, 280, 382, 2, 70)); 1628 const productImageUrl = Fn.pipe(Fn.prop('default_images'), _.partial(helpers.image, _, 280, 382, 2, 70));
1600 1629
1601 let products = _.get(recommendData, 'data.product_list', []).map((rp) => { 1630 let products = _.get(recommendData, 'data.product_list', []).map((rp) => {
@@ -27,54 +27,55 @@ const channelMap = { @@ -27,54 +27,55 @@ const channelMap = {
27 27
28 const sortMap = { 28 const sortMap = {
29 boys: [ 29 boys: [
  30 + {misort: 18, viewNum: 5},
  31 + {misort: 20, viewNum: 5},
30 {misort: 16, viewNum: 5}, 32 {misort: 16, viewNum: 5},
31 {misort: 21, viewNum: 5}, 33 {misort: 21, viewNum: 5},
32 - {misort: 1900, viewNum: 5},  
33 - {misort: 1904, viewNum: 5},  
34 - {misort: 226, viewNum: 5},  
35 - {misort: 1896, viewNum: 5}, 34 + {misort: 44, viewNum: 5},
36 {misort: 26, viewNum: 5}, 35 {misort: 26, viewNum: 5},
37 {misort: 27, viewNum: 5}, 36 {misort: 27, viewNum: 5},
38 - {misort: 44, viewNum: 5}, 37 + {misort: 1900, viewNum: 5},
39 {misort: 45, viewNum: 5}, 38 {misort: 45, viewNum: 5},
  39 + {misort: 1892, viewNum: 5},
40 {misort: 49, viewNum: 5}, 40 {misort: 49, viewNum: 5},
41 {misort: 60, viewNum: 5}, 41 {misort: 60, viewNum: 5},
42 - {misort: 39, viewNum: 5} 42 + {misort: 1896, viewNum: 5},
  43 + {misort: 39, viewNum: 5},
  44 + {misort: 59, viewNum: 5}
43 ], 45 ],
44 girls: [ 46 girls: [
  47 + {misort: 18, viewNum: 4},
  48 + {misort: 20, viewNum: 4},
45 {misort: 21, viewNum: 4}, 49 {misort: 21, viewNum: 4},
46 {misort: 16, viewNum: 4}, 50 {misort: 16, viewNum: 4},
47 {misort: 1900, viewNum: 4}, 51 {misort: 1900, viewNum: 4},
48 - {misort: 1904, viewNum: 4},  
49 - {misort: 1896, viewNum: 4},  
50 {misort: 1892, viewNum: 4}, 52 {misort: 1892, viewNum: 4},
51 - {misort: 20, viewNum: 4}, 53 + {misort: 1896, viewNum: 4},
52 {misort: 44, viewNum: 4}, 54 {misort: 44, viewNum: 4},
53 - {misort: 26, viewNum: 4},  
54 {misort: 27, viewNum: 4}, 55 {misort: 27, viewNum: 4},
  56 + {misort: 26, viewNum: 4},
55 {misort: 45, viewNum: 4}, 57 {misort: 45, viewNum: 4},
56 - {misort: 226, viewNum: 4},  
57 - {misort: 172, viewNum: 4},  
58 - {misort: 31, viewNum: 4},  
59 {misort: 49, viewNum: 4}, 58 {misort: 49, viewNum: 4},
60 - {misort: 50, viewNum: 4},  
61 - {misort: 60, viewNum: 4},  
62 - {misort: 65, viewNum: 4} 59 + {misort: 66, viewNum: 4},
  60 + {misort: 39, viewNum: 4},
  61 + {misort: 60, viewNum: 4}
63 ], 62 ],
64 kids: [ 63 kids: [
  64 + {misort: 400, viewNum: 4},
  65 + {misort: 430, viewNum: 4},
  66 + {misort: 423, viewNum: 4},
65 {misort: 396, viewNum: 4}, 67 {misort: 396, viewNum: 4},
66 {misort: 404, viewNum: 4}, 68 {misort: 404, viewNum: 4},
67 - {misort: 400, viewNum: 4},  
68 - {misort: 368, viewNum: 4},  
69 {misort: 406, viewNum: 4}, 69 {misort: 406, viewNum: 4},
70 - {misort: 390, viewNum: 4},  
71 - {misort: 414, viewNum: 4},  
72 - {misort: 448, viewNum: 4}, 70 + {misort: 368, viewNum: 4},
  71 + {misort: 384, viewNum: 4},
  72 + {misort: 369, viewNum: 4},
  73 + {misort: 388, viewNum: 4},
  74 + {misort: 392, viewNum: 4},
73 {misort: 429, viewNum: 4}, 75 {misort: 429, viewNum: 4},
  76 + {misort: 448, viewNum: 4},
74 {misort: 408, viewNum: 4}, 77 {misort: 408, viewNum: 4},
75 - {misort: 470, viewNum: 4},  
76 - {misort: 406, viewNum: 4},  
77 - {misort: 388, viewNum: 4} 78 + {misort: 414, viewNum: 4}
78 ], 79 ],
79 lifestyle: [ 80 lifestyle: [
80 {msort: 1170, viewNum: 5}, 81 {msort: 1170, viewNum: 5},
@@ -56,7 +56,7 @@ module.exports = (req, res, next) => { @@ -56,7 +56,7 @@ module.exports = (req, res, next) => {
56 _.includes(PATH_WHITE_LIST, req.path) || req.xhr || !_.isEmpty(_.get(req, 'user.uid')); 56 _.includes(PATH_WHITE_LIST, req.path) || req.xhr || !_.isEmpty(_.get(req, 'user.uid'));
57 const enabled = !_.get(req.app.locals, 'pc.sys.noLimiter'); 57 const enabled = !_.get(req.app.locals, 'pc.sys.noLimiter');
58 58
59 - logger.info(`request remote ip: ${remoteIp}; excluded: ${excluded}; enabled: ${enabled}`); 59 + logger.debug(`request remote ip: ${remoteIp}; excluded: ${excluded}; enabled: ${enabled}`);
60 60
61 // 判断获取remoteIp成功,并且开关未关闭 61 // 判断获取remoteIp成功,并且开关未关闭
62 if (enabled && remoteIp && !excluded) { 62 if (enabled && remoteIp && !excluded) {