Authored by 郝肖肖

'mip-img'

... ... @@ -309,7 +309,7 @@ const index = (req, res, next) => {
showAnaJson: {
miptitle: data.title,
mipPublishTime: guang.detail.publishTime,
mipPic: mipPic,
mipPics: [mipPic],
mipDes: guang.shareDesc,
mipUrl: `https://m.yohobuy.com/guang/${id}.html`
}
... ...
... ... @@ -166,14 +166,14 @@ const detailIndex = (req, res, next) => {
}
let guang = data.guang;
let publishTime = mipDate(detail.getArticle.publish_time);
let mipPublishTime = mipDate(detail.getArticle.publish_time);
let singleImages = _.filter(detail.getArticleContent, {singleImage: {template_name: 'single_image'}});
let mipPic = _.get(singleImages, '[0].singleImage.data[0].src', '');
guang.detail = {
id: _.get(detail, 'getArticle.id'),
title: detail.getArticle.article_title,
publishTime: publishTime,
publishTime: moment.unix(detail.getArticle.publish_time).format('YYYY-MM-DD HH:mm:ss'),
pageView: detail.getArticle.pageViews,
content: []
};
... ... @@ -218,8 +218,8 @@ const detailIndex = (req, res, next) => {
showAnaJson: {
miptitle: `${detail.getArticle.article_title} | Yoho!Buy有货 | 潮流购物逛不停`,
mipId: id,
mipPublishTime: publishTime,
mipPic: mipPic,
mipPublishTime: mipPublishTime,
mipPics: [mipPic],
mipDes: detail.getArticle.article_summary,
mipUrl: `https://m.yohobuy.com${req.originalUrl}`,
miphtml: `https://m.yohobuy.com/mip/guang/${id}.html`
... ...
... ... @@ -57,12 +57,15 @@ const newDetail = {
let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.productDetail","params":' +
JSON.stringify(appParams) +
'}';
let mipPic = _.get(result, 'bannerTop.list[0].img', '');
if (mipPic) {
mipPic = mipPic.replace(/\?(.*)/g, "?imageView2/{mode}/w/{width}/h/{height}");
}
let mipPics = _.map(_.get(result, 'bannerTop.list', []), item => {
return item.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 + '元,购买' +
result.brandName + result.sortName + ',了解' + result.brandName + result.sortName + '商品信息就上有货网!';
res.render('detail/new/detail', {
pageHeader: headerData,
result: result,
... ... @@ -70,20 +73,19 @@ const newDetail = {
canonical: {
currentHref: `https://www.yohobuy.com${req.originalUrl}`
},
title: `【${result.brandName}${result.sortName}${result.goodsName}|YOHO!BUY 有货`,
title: title,
keywords: result.brandName + result.sortName + ',' + result.brandName + result.sortName + '价格,' +
result.brandName + result.sortName + '图片,',
description: result.goodsName + ' 有货网仅售' + result.goodsPrice.currentPrice + '元,购买' +
result.brandName + result.sortName + ',了解' + result.brandName + result.sortName + '商品信息就上有货网!',
description: description,
pageFooter: true,
localCss: true,
appPath: appPath,
isMarsApp: req.yoho.isMarsApp, // 判断mars
showAnaJson: {
miptitle: result.goodsName,
miptitle: title,
mipPublishTime: '',// mip日期必填
mipPic: mipPic,
mipDes: result.phrase,
mipPics: mipPics.slice(0, 5),
mipDes: description,
mipUrl: `http://m.yohobuy.com/product/${result.productSkn}.html`
}
});
... ...
... ... @@ -6,7 +6,13 @@
"appid": "1583402501013173",
"title": "{{miptitle}}",
"images": [
{{#if mipPic}}"http:{{image mipPic 600 400}}"{{/if}}
{{# mipPics}}
{{#isEqualOr @index 0}}
{{#if .}}"http:{{image . 750 500 1}}"{{/if}}
{{else}}
{{#if .}},"http:{{image . 750 500 1}}"{{/if}}
{{/isEqualOr}}
{{/mipPics}}
],
"description": "{{mipDes}}",
"pubDate": "{{mipPublishTime}}"
... ...