Authored by 毕凯

Merge branch 'gray' into 'master'

Gray



See merge request !1213
@@ -307,12 +307,12 @@ const index = (req, res, next) => { @@ -307,12 +307,12 @@ const index = (req, res, next) => {
307 isShare: isShare, 307 isShare: isShare,
308 id: id, 308 id: id,
309 showAnaJson: { 309 showAnaJson: {
310 - mipsite: true,  
311 - miptitle: data.title,  
312 - mipPublishTime: guang.detail.publishTime,  
313 - mipPic: mipPic,  
314 - mipDes: guang.shareDesc,  
315 - mipUrl: `${req.protocol}://m.yohobuy.com/guang/${id}.html` 310 + addBaiduSite: true,
  311 + title: data.title,
  312 + publishTime: guang.detail.publishTime,
  313 + pic: mipPic,
  314 + des: guang.shareDesc,
  315 + url: `${req.protocol}://m.yohobuy.com/guang/${id}.html`
316 } 316 }
317 }, data, parameter)); 317 }, data, parameter));
318 })().catch(next); 318 })().catch(next);
@@ -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 +};
@@ -216,14 +216,12 @@ const detailIndex = (req, res, next) => { @@ -216,14 +216,12 @@ const detailIndex = (req, res, next) => {
216 currentHref: `https://m.yohobuy.com/guang/${id}.html` 216 currentHref: `https://m.yohobuy.com/guang/${id}.html`
217 }, 217 },
218 showAnaJson: { 218 showAnaJson: {
219 - mipsite: false,  
220 - miptitle: `${detail.getArticle.article_title} | Yoho!Buy有货 | 潮流购物逛不停`,  
221 - mipId: id,  
222 - mipPublishTime: mipPublishTime,  
223 - mipPic: mipPic,  
224 - mipDes: detail.getArticle.article_summary,  
225 - mipUrl: `${req.protocol}://m.yohobuy.com${req.originalUrl}`,  
226 - miphtml: `${req.protocol}://m.yohobuy.com/mip/guang/${id}.html` 219 + addBaiduSite: false,
  220 + title: `${detail.getArticle.article_title} | Yoho!Buy有货 | 潮流购物逛不停`,
  221 + publishTime: mipPublishTime,
  222 + pic: mipPic,
  223 + des: detail.getArticle.article_summary,
  224 + url: `${req.protocol}://m.yohobuy.com${req.originalUrl}`,
227 } 225 }
228 }, data)); 226 }, data));
229 })().catch(next); 227 })().catch(next);
@@ -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);
@@ -85,12 +85,12 @@ const newDetail = { @@ -85,12 +85,12 @@ const newDetail = {
85 appPath: appPath, 85 appPath: appPath,
86 isMarsApp: req.yoho.isMarsApp, // 判断mars 86 isMarsApp: req.yoho.isMarsApp, // 判断mars
87 showAnaJson: { 87 showAnaJson: {
88 - mipsite: true,  
89 - miptitle: title,  
90 - mipPublishTime: moment.unix(result.shelveTime).format('YYYY-MM-DDTHH:mm:ss'), // mip日期必填  
91 - mipPic: mipPic,  
92 - mipDes: description,  
93 - mipUrl: `${req.protocol}://m.yohobuy.com/product/${result.productSkn}.html` 88 + addBaiduSite: true,
  89 + title: title,
  90 + publishTime: moment.unix(result.shelveTime).format('YYYY-MM-DDTHH:mm:ss'), // mip日期必填
  91 + pic: mipPic,
  92 + des: description,
  93 + url: `${req.protocol}://m.yohobuy.com/product/${result.productSkn}.html`
94 }, 94 },
95 miniPath: helpers.urlFormat('/api/wechat/miniapp.jpg', { 95 miniPath: helpers.urlFormat('/api/wechat/miniapp.jpg', {
96 miniapp_type: 0, 96 miniapp_type: 0,
@@ -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,
@@ -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 mipsite}}<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",
6 - "@id": "{{mipUrl}}", 5 + "@id": "{{url}}",
7 "appid": "1583402501013173", 6 "appid": "1583402501013173",
8 - "title": "{{miptitle}}", 7 + "title": "{{title}}",
9 "images": [ 8 "images": [
10 - {{#if mipPic}}"http:{{image mipPic 750 500 1}}"{{/if}} 9 + {{#if pic}}"http:{{image pic 750 500 1}}"{{/if}}
11 ], 10 ],
12 - "description": "{{mipDes}}",  
13 - "pubDate": "{{mipPublishTime}}" 11 + "description": "{{des}}",
  12 + "pubDate": "{{publishTime}}"
14 } 13 }
15 </script> 14 </script>
16 {{/showAnaJson}} 15 {{/showAnaJson}}