Authored by 郝肖肖

'商品详情结构化数据加日期'

... ... @@ -311,7 +311,7 @@ const index = (req, res, next) => {
mipPublishTime: guang.detail.publishTime,
mipPics: [mipPic],
mipDes: guang.shareDesc,
mipUrl: `https://m.yohobuy.com/guang/${id}.html`
mipUrl: `${req.protocol}://m.yohobuy.com/guang/${id}.html`
}
}, data, parameter));
})().catch(next);
... ...
... ... @@ -221,8 +221,8 @@ const detailIndex = (req, res, next) => {
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`
mipUrl: `${req.protocol}://m.yohobuy.com${req.originalUrl}`,
miphtml: `${req.protocol}://m.yohobuy.com/mip/guang/${id}.html`
}
}, data));
})().catch(next);
... ...
... ... @@ -9,6 +9,7 @@ const newDetailModel = require('../models/new-detail');
const listModel = require('../models/list');
const headerModel = require('../../../doraemon/models/header'); // 头部model
const qs = require('querystring');
const moment = require('moment');
const tdk = require('../../../utils/getTDK');
const helpers = global.yoho.helpers;
... ... @@ -57,11 +58,14 @@ 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}");
});
if (mipPics.length <= 0) {
mipPics.push(_.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 + '元,购买' +
result.brandName + result.sortName + ',了解' + result.brandName + result.sortName + '商品信息就上有货网!';
... ... @@ -83,10 +87,10 @@ const newDetail = {
isMarsApp: req.yoho.isMarsApp, // 判断mars
showAnaJson: {
miptitle: title,
mipPublishTime: '',// mip日期必填
mipPublishTime: moment.unix(result.shelveTime).format('YYYY-MM-DDTHH:mm:ss'),// mip日期必填
mipPics: mipPics.slice(0, 5),
mipDes: description,
mipUrl: `http://m.yohobuy.com/product/${result.productSkn}.html`
mipUrl: `${req.protocol}://m.yohobuy.com/product/${result.productSkn}.html`
}
});
}).catch(next);
... ...
... ... @@ -30,6 +30,8 @@ class DetailProcess {
// 商品短语
dest.phrase = _.get(origin, 'phrase', '');
dest.shelveTime = _.get(origin, 'shelveTime', 0);
// 商品标签
if (origin.tags) {
let productTags = {};
... ...