Authored by 郝肖肖

Merge branch 'master' into feature/backDown

@@ -37,3 +37,11 @@ exports.index = (req, res, next) => { @@ -37,3 +37,11 @@ exports.index = (req, res, next) => {
37 }, goodsList)); 37 }, goodsList));
38 })().catch(next); 38 })().catch(next);
39 }; 39 };
  40 +
  41 +// 301到新路由
  42 +exports.redirect = (req, res) => {
  43 + let redirectUrl = '/mip/chanpin/';
  44 +
  45 + redirectUrl += `${req.params.id}.html`;
  46 + res.redirect(301, redirectUrl);
  47 +};
@@ -302,7 +302,7 @@ @@ -302,7 +302,7 @@
302 } 302 }
303 303
304 .mip-footer .mip-gototop { 304 .mip-footer .mip-gototop {
305 - display: inline; 305 + display: inline !important;
306 } 306 }
307 307
308 .list-too-little { 308 .list-too-little {
@@ -60,7 +60,7 @@ class List extends global.yoho.BaseModel { @@ -60,7 +60,7 @@ class List extends global.yoho.BaseModel {
60 _.forEach(_.slice(redisData.data, 0, 12), value => { 60 _.forEach(_.slice(redisData.data, 0, 12), value => {
61 build.push({ 61 build.push({
62 name: value.keyword, 62 name: value.keyword,
63 - link: helpers.urlFormat(`/mip/list/${value.id}.html`, null) 63 + link: helpers.urlFormat(`/mip/chanpin/${value.id}.html`, null)
64 }); 64 });
65 }); 65 });
66 resu.name = redisData.name; 66 resu.name = redisData.name;
@@ -20,5 +20,6 @@ router.get(/^\/guang\/info\/(.*?)\.html/, rewrite.resolve, guang.detailIndex); @@ -20,5 +20,6 @@ router.get(/^\/guang\/info\/(.*?)\.html/, rewrite.resolve, guang.detailIndex);
20 router.get(/^\/guang\/(.*?)\.html/, rewrite.resolve, guang.detailIndex); 20 router.get(/^\/guang\/(.*?)\.html/, rewrite.resolve, guang.detailIndex);
21 21
22 router.get('/chanpin/:id.html', chanpin.index); 22 router.get('/chanpin/:id.html', chanpin.index);
  23 +router.get('/list/:id.html', chanpin.redirect);
23 24
24 module.exports = router; 25 module.exports = router;
@@ -294,20 +294,6 @@ const category = (req, res, next) => { @@ -294,20 +294,6 @@ const category = (req, res, next) => {
294 */ 294 */
295 const listNew = (req, res, next) => { 295 const listNew = (req, res, next) => {
296 let params = _.assign({}, req.query); 296 let params = _.assign({}, req.query);
297 -  
298 - /* 勿修改,唤起 APP 使用 */  
299 - let appParams = _.assign({}, req.query, {  
300 - title: req.query.title || req.query.sort_name || '',  
301 - productPool: req.query.filter_poolId,  
302 - actiontype: req.query.actiontype || '1'  
303 - });  
304 -  
305 - delete appParams.filter_poolId;  
306 -  
307 - let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.list","params":' +  
308 - JSON.stringify(appParams) +  
309 - '}';  
310 -  
311 let uid = req.user.uid; 297 let uid = req.user.uid;
312 298
313 // 获取第一页数据做服务端渲染 299 // 获取第一页数据做服务端渲染
@@ -372,7 +358,6 @@ const listNew = (req, res, next) => { @@ -372,7 +358,6 @@ const listNew = (req, res, next) => {
372 firstPageGoods: responseResult || [], 358 firstPageGoods: responseResult || [],
373 pageFooter: true, 359 pageFooter: true,
374 localCss: true, 360 localCss: true,
375 - appPath: appPath,  
376 categoryIntro: categoryIntro 361 categoryIntro: categoryIntro
377 }, seoRenderData)); 362 }, seoRenderData));
378 })().catch(next); 363 })().catch(next);
@@ -583,13 +583,15 @@ const shop = { @@ -583,13 +583,15 @@ const shop = {
583 params.limit = 24; 583 params.limit = 24;
584 584
585 req.ctx(searchModel).getShopGoods(params).then((result) => { 585 req.ctx(searchModel).getShopGoods(params).then((result) => {
586 - if (result.data.product_list && result.data.product_list.length > 0) {  
587 -  
588 - let product_list = productProcess.processProductList(result.data.product_list || [], {  
589 - isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'),  
590 - gender: _coverChannel[params.coverChannel],  
591 - showSimilar: params.shop_id || params.material === 'true' ? false : true  
592 - }); 586 + let productList = _.get(result, 'data.product_list', []);
  587 +
  588 + if (productList.length > 0) {
  589 + let product_list =
  590 + productProcess.processProductList(productList, {
  591 + isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'),
  592 + gender: _coverChannel[params.coverChannel],
  593 + showSimilar: params.shop_id || params.material === 'true' ? false : true
  594 + });
593 595
594 res.render('search/page', { 596 res.render('search/page', {
595 layout: false, 597 layout: false,
@@ -93,7 +93,7 @@ let index = (req, res, next) => { @@ -93,7 +93,7 @@ let index = (req, res, next) => {
93 93
94 // 扩展头部频道选择数据 94 // 扩展头部频道选择数据
95 Object.assign(params.renderData.pageHeader, { 95 Object.assign(params.renderData.pageHeader, {
96 - saleNav: saleModel.saleNav(params.channel, req.params[0] || !req.query.channel) 96 + saleNav: saleModel.saleNav(params.channel)
97 }); 97 });
98 98
99 // 此处 channel 需要读取 cookies 的 channel 99 // 此处 channel 需要读取 cookies 的 channel
@@ -14,7 +14,6 @@ const processTime = require(`${utils}/time-process`); @@ -14,7 +14,6 @@ const processTime = require(`${utils}/time-process`);
14 const _ = require('lodash'); 14 const _ = require('lodash');
15 const api = global.yoho.API; 15 const api = global.yoho.API;
16 const serviceAPI = global.yoho.ServiceAPI; 16 const serviceAPI = global.yoho.ServiceAPI;
17 -const helpers = global.yoho.helpers;  
18 17
19 /** 18 /**
20 * 排序转换 19 * 排序转换
@@ -46,32 +45,28 @@ const channelType = { @@ -46,32 +45,28 @@ const channelType = {
46 * 产品要求,SALE的导航显示 Boy,Girl 单数形式 45 * 产品要求,SALE的导航显示 Boy,Girl 单数形式
47 */ 46 */
48 const channelHash = { 47 const channelHash = {
49 - boys: 'Boy',  
50 - girls: 'Girl',  
51 - kids: 'Kid', 48 + boys: 'Boys',
  49 + girls: 'Girls',
  50 + kids: 'Kids',
52 lifestyle: 'Lifestyle' 51 lifestyle: 'Lifestyle'
53 }; 52 };
54 53
55 -const saleNav = (channel, shortUrl) => { 54 +const saleNav = (channel) => {
56 return { 55 return {
57 channel: channelHash[channel], 56 channel: channelHash[channel],
58 list: [ 57 list: [
59 { 58 {
60 - title: 'Boy',  
61 - url: shortUrl ? helpers.urlFormat('/product/boys-sale/') :  
62 - helpers.urlFormat('/product/sale', {channel: 'boys'}) 59 + title: 'Boys',
  60 + url: '/boys-sale'
63 }, { 61 }, {
64 - title: 'Girl',  
65 - url: shortUrl ? helpers.urlFormat('/product/girls-sale/') :  
66 - helpers.urlFormat('/product/sale', {channel: 'girls'}) 62 + title: 'Girls',
  63 + url: '/girls-sale'
67 }, { 64 }, {
68 - title: 'Kid',  
69 - url: shortUrl ? helpers.urlFormat('/product/kids-sale/') :  
70 - helpers.urlFormat('/product/sale', {channel: 'kids'}) 65 + title: 'Kids',
  66 + url: '/kids-sale'
71 }, { 67 }, {
72 title: 'Lifestyle', 68 title: 'Lifestyle',
73 - url: shortUrl ? helpers.urlFormat('/product/lifestyle-sale/') :  
74 - helpers.urlFormat('/product/sale', {channel: 'lifestyle'}) 69 + url: '/lifestyle-sale'
75 } 70 }
76 ] 71 ]
77 }; 72 };
@@ -22,8 +22,6 @@ @@ -22,8 +22,6 @@
22 <link rel="dns-prefetch" href="{{this}}"> 22 <link rel="dns-prefetch" href="{{this}}">
23 {{/dnsPrefetch.hosts}} 23 {{/dnsPrefetch.hosts}}
24 24
25 - {{> ld-json}}  
26 -  
27 <script> 25 <script>
28 {{#ifand isProduction wap.open.bughd}} 26 {{#ifand isProduction wap.open.bughd}}
29 window._timeStart = new Date().getTime(); 27 window._timeStart = new Date().getTime();
@@ -87,6 +85,8 @@ @@ -87,6 +85,8 @@
87 <link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-x.png" media="screen and (min-device-width: 751px) and (max-device-width: 1125px)"> 85 <link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-x.png" media="screen and (min-device-width: 751px) and (max-device-width: 1125px)">
88 <link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-6.png" media="screen and (min-device-width: 641px) and (max-device-width: 750px)"> 86 <link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-6.png" media="screen and (min-device-width: 641px) and (max-device-width: 750px)">
89 <link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-5.png" media="screen and (max-device-width: 640px)"> 87 <link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-5.png" media="screen and (max-device-width: 640px)">
  88 +
  89 + {{> ld-json}}
90 </head> 90 </head>
91 <body class="{{pageStyle}}{{#if isWechat}} wechat-body{{/if}}{{#if width750}} width750{{/if}}{{#if isPassportPage}} passport-body{{/if}}{{#if isStarIndexPage}} star-index-bg{{/if}}{{#if isStarDetailPage}} star-class-body{{/if}}{{#if isInstallmentPage}} installment-body{{/if}}{{#if @root.isMarsApp}} is-mars-app{{/if}}{{#if @root.isNowApp}} is-now-app{{/if}}"> 91 <body class="{{pageStyle}}{{#if isWechat}} wechat-body{{/if}}{{#if width750}} width750{{/if}}{{#if isPassportPage}} passport-body{{/if}}{{#if isStarIndexPage}} star-index-bg{{/if}}{{#if isStarDetailPage}} star-class-body{{/if}}{{#if isInstallmentPage}} installment-body{{/if}}{{#if @root.isMarsApp}} is-mars-app{{/if}}{{#if @root.isNowApp}} is-now-app{{/if}}">
92 <div class="main-wrap" id="main-wrap" {{#if appPath}}data-apppath='{{{appPath}}}'{{/if}} {{#if miniPath}}data-miniPath='{{{miniPath}}}'{{/if}}> 92 <div class="main-wrap" id="main-wrap" {{#if appPath}}data-apppath='{{{appPath}}}'{{/if}} {{#if miniPath}}data-miniPath='{{{miniPath}}}'{{/if}}>
@@ -130,5 +130,8 @@ @@ -130,5 +130,8 @@
130 {{#unless devEnv}} 130 {{#unless devEnv}}
131 {{> analysis}} 131 {{> analysis}}
132 {{/unless}} 132 {{/unless}}
  133 + {{# showAnaJson}}
  134 + {{#if addBaiduSite}}<script src="//msite.baidu.com/sdk/c.js?appid=1583402501013173"></script>{{/if}}
  135 + {{/showAnaJson}}
133 </body> 136 </body>
134 </html> 137 </html>
1 {{# showAnaJson}} 1 {{# showAnaJson}}
2 -{{#if addBaiduSite}}<script src="//msite.baidu.com/sdk/c.js?appid=1583402501013173"></script>{{/if}}  
3 <script type="application/ld+json"> 2 <script type="application/ld+json">
4 { 3 {
5 "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld", 4 "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
@@ -72,7 +72,7 @@ @@ -72,7 +72,7 @@
72 "xml2js": "^0.4.19", 72 "xml2js": "^0.4.19",
73 "yoho-express-session": "^2.0.0", 73 "yoho-express-session": "^2.0.0",
74 "yoho-md5": "^2.0.0", 74 "yoho-md5": "^2.0.0",
75 - "yoho-node-lib": "=0.6.0", 75 + "yoho-node-lib": "=0.6.1",
76 "yoho-zookeeper": "^1.0.8" 76 "yoho-zookeeper": "^1.0.8"
77 }, 77 },
78 "devDependencies": { 78 "devDependencies": {