Authored by 郝肖肖

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

@@ -311,7 +311,7 @@ const index = (req, res, next) => { @@ -311,7 +311,7 @@ const index = (req, res, next) => {
311 mipPublishTime: guang.detail.publishTime, 311 mipPublishTime: guang.detail.publishTime,
312 mipPics: [mipPic], 312 mipPics: [mipPic],
313 mipDes: guang.shareDesc, 313 mipDes: guang.shareDesc,
314 - mipUrl: `https://m.yohobuy.com/guang/${id}.html` 314 + mipUrl: `${req.protocol}://m.yohobuy.com/guang/${id}.html`
315 } 315 }
316 }, data, parameter)); 316 }, data, parameter));
317 })().catch(next); 317 })().catch(next);
@@ -221,8 +221,8 @@ const detailIndex = (req, res, next) => { @@ -221,8 +221,8 @@ const detailIndex = (req, res, next) => {
221 mipPublishTime: mipPublishTime, 221 mipPublishTime: mipPublishTime,
222 mipPics: [mipPic], 222 mipPics: [mipPic],
223 mipDes: detail.getArticle.article_summary, 223 mipDes: detail.getArticle.article_summary,
224 - mipUrl: `https://m.yohobuy.com${req.originalUrl}`,  
225 - miphtml: `https://m.yohobuy.com/mip/guang/${id}.html` 224 + mipUrl: `${req.protocol}://m.yohobuy.com${req.originalUrl}`,
  225 + miphtml: `${req.protocol}://m.yohobuy.com/mip/guang/${id}.html`
226 } 226 }
227 }, data)); 227 }, data));
228 })().catch(next); 228 })().catch(next);
@@ -9,6 +9,7 @@ const newDetailModel = require('../models/new-detail'); @@ -9,6 +9,7 @@ const newDetailModel = require('../models/new-detail');
9 const listModel = require('../models/list'); 9 const listModel = require('../models/list');
10 const headerModel = require('../../../doraemon/models/header'); // 头部model 10 const headerModel = require('../../../doraemon/models/header'); // 头部model
11 const qs = require('querystring'); 11 const qs = require('querystring');
  12 +const moment = require('moment');
12 const tdk = require('../../../utils/getTDK'); 13 const tdk = require('../../../utils/getTDK');
13 const helpers = global.yoho.helpers; 14 const helpers = global.yoho.helpers;
14 15
@@ -57,11 +58,14 @@ const newDetail = { @@ -57,11 +58,14 @@ const newDetail = {
57 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":' +
58 JSON.stringify(appParams) + 59 JSON.stringify(appParams) +
59 '}'; 60 '}';
60 -  
61 let mipPics = _.map(_.get(result, 'bannerTop.list', []), item => { 61 let mipPics = _.map(_.get(result, 'bannerTop.list', []), item => {
62 return item.img.replace(/\?(.*)/g, "?imageView2/{mode}/w/{width}/h/{height}"); 62 return item.img.replace(/\?(.*)/g, "?imageView2/{mode}/w/{width}/h/{height}");
63 }); 63 });
64 - 64 +
  65 + if (mipPics.length <= 0) {
  66 + mipPics.push(_.get(result, 'bannerTop.img', '').replace(/\?(.*)/g, "?imageView2/{mode}/w/{width}/h/{height}"));
  67 + }
  68 +
65 let title = `【${result.brandName}${result.sortName}${result.goodsName}|YOHO!BUY 有货`; 69 let title = `【${result.brandName}${result.sortName}${result.goodsName}|YOHO!BUY 有货`;
66 let description = result.goodsName + ' 有货网仅售' + result.goodsPrice.currentPrice + '元,购买' + 70 let description = result.goodsName + ' 有货网仅售' + result.goodsPrice.currentPrice + '元,购买' +
67 result.brandName + result.sortName + ',了解' + result.brandName + result.sortName + '商品信息就上有货网!'; 71 result.brandName + result.sortName + ',了解' + result.brandName + result.sortName + '商品信息就上有货网!';
@@ -83,10 +87,10 @@ const newDetail = { @@ -83,10 +87,10 @@ const newDetail = {
83 isMarsApp: req.yoho.isMarsApp, // 判断mars 87 isMarsApp: req.yoho.isMarsApp, // 判断mars
84 showAnaJson: { 88 showAnaJson: {
85 miptitle: title, 89 miptitle: title,
86 - mipPublishTime: '',// mip日期必填 90 + mipPublishTime: moment.unix(result.shelveTime).format('YYYY-MM-DDTHH:mm:ss'),// mip日期必填
87 mipPics: mipPics.slice(0, 5), 91 mipPics: mipPics.slice(0, 5),
88 mipDes: description, 92 mipDes: description,
89 - mipUrl: `http://m.yohobuy.com/product/${result.productSkn}.html` 93 + mipUrl: `${req.protocol}://m.yohobuy.com/product/${result.productSkn}.html`
90 } 94 }
91 }); 95 });
92 }).catch(next); 96 }).catch(next);
@@ -30,6 +30,8 @@ class DetailProcess { @@ -30,6 +30,8 @@ class DetailProcess {
30 // 商品短语 30 // 商品短语
31 dest.phrase = _.get(origin, 'phrase', ''); 31 dest.phrase = _.get(origin, 'phrase', '');
32 32
  33 + dest.shelveTime = _.get(origin, 'shelveTime', 0);
  34 +
33 // 商品标签 35 // 商品标签
34 if (origin.tags) { 36 if (origin.tags) {
35 let productTags = {}; 37 let productTags = {};