Authored by 毕凯

Merge branch 'hotfix/sale' into 'master'

Hotfix/sale



See merge request !1205
... ... @@ -307,9 +307,10 @@ const index = (req, res, next) => {
isShare: isShare,
id: id,
showAnaJson: {
mipsite: true,
miptitle: data.title,
mipPublishTime: guang.detail.publishTime,
mipPics: [mipPic],
mipPic: mipPic,
mipDes: guang.shareDesc,
mipUrl: `${req.protocol}://m.yohobuy.com/guang/${id}.html`
}
... ...
... ... @@ -216,10 +216,11 @@ const detailIndex = (req, res, next) => {
currentHref: `https://m.yohobuy.com/guang/${id}.html`
},
showAnaJson: {
mipsite: false,
miptitle: `${detail.getArticle.article_title} | Yoho!Buy有货 | 潮流购物逛不停`,
mipId: id,
mipPublishTime: mipPublishTime,
mipPics: [mipPic],
mipPic: mipPic,
mipDes: detail.getArticle.article_summary,
mipUrl: `${req.protocol}://m.yohobuy.com${req.originalUrl}`,
miphtml: `${req.protocol}://m.yohobuy.com/mip/guang/${id}.html`
... ...
... ... @@ -58,16 +58,12 @@ const newDetail = {
let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.productDetail","params":' +
JSON.stringify(appParams) +
'}';
let mipPics = _.map(_.get(result, 'bannerTop.list', []), item => {
return item.img.replace(/\?(.*)/g, '?imageView2/{mode}/w/{width}/h/{height}');
});
let mipPic = _.get(result, 'bannerTop.list[0].img', '');
if (mipPics.length <= 0) {
mipPics.push(_.get(result, 'bannerTop.img', '').replace(
/\?(.*)/g,
'?imageView2/{mode}/w/{width}/h/{height}'
));
}
mipPic = (mipPic ? mipPic : _.get(result, 'bannerTop.img', '')).replace(
/\?(.*)/g,
'?imageView2/{mode}/w/{width}/h/{height}'
);
let title = `【${result.brandName}${result.sortName}${result.goodsName}|YOHO!BUY 有货`;
let description = result.goodsName + ' 有货网仅售' + result.goodsPrice.currentPrice + '元,购买' +
... ... @@ -89,9 +85,10 @@ const newDetail = {
appPath: appPath,
isMarsApp: req.yoho.isMarsApp, // 判断mars
showAnaJson: {
mipsite: true,
miptitle: title,
mipPublishTime: moment.unix(result.shelveTime).format('YYYY-MM-DDTHH:mm:ss'), // mip日期必填
mipPics: mipPics.slice(0, 5),
mipPic: mipPic,
mipDes: description,
mipUrl: `${req.protocol}://m.yohobuy.com/product/${result.productSkn}.html`
},
... ...
... ... @@ -93,7 +93,7 @@ let index = (req, res, next) => {
// 扩展头部频道选择数据
Object.assign(params.renderData.pageHeader, {
saleNav: saleModel.saleNav(params.channel, req.params[0] || !req.query.channel)
saleNav: saleModel.saleNav(params.channel)
});
// 此处 channel 需要读取 cookies 的 channel
... ...
... ... @@ -14,7 +14,6 @@ const processTime = require(`${utils}/time-process`);
const _ = require('lodash');
const api = global.yoho.API;
const serviceAPI = global.yoho.ServiceAPI;
const helpers = global.yoho.helpers;
/**
* 排序转换
... ... @@ -46,32 +45,28 @@ const channelType = {
* 产品要求,SALE的导航显示 Boy,Girl 单数形式
*/
const channelHash = {
boys: 'Boy',
girls: 'Girl',
kids: 'Kid',
boys: 'Boys',
girls: 'Girls',
kids: 'Kids',
lifestyle: 'Lifestyle'
};
const saleNav = (channel, shortUrl) => {
const saleNav = (channel) => {
return {
channel: channelHash[channel],
list: [
{
title: 'Boy',
url: shortUrl ? helpers.urlFormat('/product/boys-sale/') :
helpers.urlFormat('/product/sale', {channel: 'boys'})
title: 'Boys',
url: '/boys-sale'
}, {
title: 'Girl',
url: shortUrl ? helpers.urlFormat('/product/girls-sale/') :
helpers.urlFormat('/product/sale', {channel: 'girls'})
title: 'Girls',
url: '/girls-sale'
}, {
title: 'Kid',
url: shortUrl ? helpers.urlFormat('/product/kids-sale/') :
helpers.urlFormat('/product/sale', {channel: 'kids'})
title: 'Kids',
url: '/kids-sale'
}, {
title: 'Lifestyle',
url: shortUrl ? helpers.urlFormat('/product/lifestyle-sale/') :
helpers.urlFormat('/product/sale', {channel: 'lifestyle'})
url: '/lifestyle-sale'
}
]
};
... ...
{{# showAnaJson}}
{{#if mipsite}}<script src="//msite.baidu.com/sdk/c.js?appid=1583402501013173"></script>{{/if}}
<script type="application/ld+json">
{
"@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
... ... @@ -6,13 +7,7 @@
"appid": "1583402501013173",
"title": "{{miptitle}}",
"images": [
{{# mipPics}}
{{#isEqualOr @index 0}}
{{#if .}}"http:{{image . 750 500 1}}"{{/if}}
{{else}}
{{#if .}},"http:{{image . 750 500 1}}"{{/if}}
{{/isEqualOr}}
{{/mipPics}}
{{#if mipPic}}"http:{{image mipPic 750 500 1}}"{{/if}}
],
"description": "{{mipDes}}",
"pubDate": "{{mipPublishTime}}"
... ...
... ... @@ -72,7 +72,7 @@
"xml2js": "^0.4.19",
"yoho-express-session": "^2.0.0",
"yoho-md5": "^2.0.0",
"yoho-node-lib": "=0.6.0",
"yoho-node-lib": "=0.6.1",
"yoho-zookeeper": "^1.0.8"
},
"devDependencies": {
... ...