Merge branch 'hotfix/sale' into 'master'
Hotfix/sale See merge request !1205
Showing
7 changed files
with
26 additions
and
37 deletions
@@ -307,9 +307,10 @@ const index = (req, res, next) => { | @@ -307,9 +307,10 @@ const index = (req, res, next) => { | ||
307 | isShare: isShare, | 307 | isShare: isShare, |
308 | id: id, | 308 | id: id, |
309 | showAnaJson: { | 309 | showAnaJson: { |
310 | + mipsite: true, | ||
310 | miptitle: data.title, | 311 | miptitle: data.title, |
311 | mipPublishTime: guang.detail.publishTime, | 312 | mipPublishTime: guang.detail.publishTime, |
312 | - mipPics: [mipPic], | 313 | + mipPic: mipPic, |
313 | mipDes: guang.shareDesc, | 314 | mipDes: guang.shareDesc, |
314 | mipUrl: `${req.protocol}://m.yohobuy.com/guang/${id}.html` | 315 | mipUrl: `${req.protocol}://m.yohobuy.com/guang/${id}.html` |
315 | } | 316 | } |
@@ -216,10 +216,11 @@ const detailIndex = (req, res, next) => { | @@ -216,10 +216,11 @@ 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, | ||
219 | miptitle: `${detail.getArticle.article_title} | Yoho!Buy有货 | 潮流购物逛不停`, | 220 | miptitle: `${detail.getArticle.article_title} | Yoho!Buy有货 | 潮流购物逛不停`, |
220 | mipId: id, | 221 | mipId: id, |
221 | mipPublishTime: mipPublishTime, | 222 | mipPublishTime: mipPublishTime, |
222 | - mipPics: [mipPic], | 223 | + mipPic: mipPic, |
223 | mipDes: detail.getArticle.article_summary, | 224 | mipDes: detail.getArticle.article_summary, |
224 | mipUrl: `${req.protocol}://m.yohobuy.com${req.originalUrl}`, | 225 | mipUrl: `${req.protocol}://m.yohobuy.com${req.originalUrl}`, |
225 | miphtml: `${req.protocol}://m.yohobuy.com/mip/guang/${id}.html` | 226 | miphtml: `${req.protocol}://m.yohobuy.com/mip/guang/${id}.html` |
@@ -58,16 +58,12 @@ const newDetail = { | @@ -58,16 +58,12 @@ const newDetail = { | ||
58 | let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.productDetail","params":' + | 58 | let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.productDetail","params":' + |
59 | JSON.stringify(appParams) + | 59 | JSON.stringify(appParams) + |
60 | '}'; | 60 | '}'; |
61 | - let mipPics = _.map(_.get(result, 'bannerTop.list', []), item => { | ||
62 | - return item.img.replace(/\?(.*)/g, '?imageView2/{mode}/w/{width}/h/{height}'); | ||
63 | - }); | 61 | + let mipPic = _.get(result, 'bannerTop.list[0].img', ''); |
64 | 62 | ||
65 | - if (mipPics.length <= 0) { | ||
66 | - mipPics.push(_.get(result, 'bannerTop.img', '').replace( | ||
67 | - /\?(.*)/g, | ||
68 | - '?imageView2/{mode}/w/{width}/h/{height}' | ||
69 | - )); | ||
70 | - } | 63 | + mipPic = (mipPic ? mipPic : _.get(result, 'bannerTop.img', '')).replace( |
64 | + /\?(.*)/g, | ||
65 | + '?imageView2/{mode}/w/{width}/h/{height}' | ||
66 | + ); | ||
71 | 67 | ||
72 | let title = `【${result.brandName}${result.sortName}】${result.goodsName}|YOHO!BUY 有货`; | 68 | let title = `【${result.brandName}${result.sortName}】${result.goodsName}|YOHO!BUY 有货`; |
73 | let description = result.goodsName + ' 有货网仅售' + result.goodsPrice.currentPrice + '元,购买' + | 69 | let description = result.goodsName + ' 有货网仅售' + result.goodsPrice.currentPrice + '元,购买' + |
@@ -89,9 +85,10 @@ const newDetail = { | @@ -89,9 +85,10 @@ const newDetail = { | ||
89 | appPath: appPath, | 85 | appPath: appPath, |
90 | isMarsApp: req.yoho.isMarsApp, // 判断mars | 86 | isMarsApp: req.yoho.isMarsApp, // 判断mars |
91 | showAnaJson: { | 87 | showAnaJson: { |
88 | + mipsite: true, | ||
92 | miptitle: title, | 89 | miptitle: title, |
93 | mipPublishTime: moment.unix(result.shelveTime).format('YYYY-MM-DDTHH:mm:ss'), // mip日期必填 | 90 | mipPublishTime: moment.unix(result.shelveTime).format('YYYY-MM-DDTHH:mm:ss'), // mip日期必填 |
94 | - mipPics: mipPics.slice(0, 5), | 91 | + mipPic: mipPic, |
95 | mipDes: description, | 92 | mipDes: description, |
96 | mipUrl: `${req.protocol}://m.yohobuy.com/product/${result.productSkn}.html` | 93 | mipUrl: `${req.protocol}://m.yohobuy.com/product/${result.productSkn}.html` |
97 | }, | 94 | }, |
@@ -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 | }; |
1 | {{# showAnaJson}} | 1 | {{# showAnaJson}} |
2 | +{{#if mipsite}}<script src="//msite.baidu.com/sdk/c.js?appid=1583402501013173"></script>{{/if}} | ||
2 | <script type="application/ld+json"> | 3 | <script type="application/ld+json"> |
3 | { | 4 | { |
4 | "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld", | 5 | "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld", |
@@ -6,13 +7,7 @@ | @@ -6,13 +7,7 @@ | ||
6 | "appid": "1583402501013173", | 7 | "appid": "1583402501013173", |
7 | "title": "{{miptitle}}", | 8 | "title": "{{miptitle}}", |
8 | "images": [ | 9 | "images": [ |
9 | - {{# mipPics}} | ||
10 | - {{#isEqualOr @index 0}} | ||
11 | - {{#if .}}"http:{{image . 750 500 1}}"{{/if}} | ||
12 | - {{else}} | ||
13 | - {{#if .}},"http:{{image . 750 500 1}}"{{/if}} | ||
14 | - {{/isEqualOr}} | ||
15 | - {{/mipPics}} | 10 | + {{#if mipPic}}"http:{{image mipPic 750 500 1}}"{{/if}} |
16 | ], | 11 | ], |
17 | "description": "{{mipDes}}", | 12 | "description": "{{mipDes}}", |
18 | "pubDate": "{{mipPublishTime}}" | 13 | "pubDate": "{{mipPublishTime}}" |
@@ -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": { |
-
Please register or login to post a comment