Authored by 郭成尧

processArticleDetail-ok

... ... @@ -410,12 +410,38 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW
// 相关推荐
if (_.get(value, 'goods.data', false)) {
console.log('^-^');
let relatedReco = [];
let moreThanOne = _.get(value, 'goods.data', []).length > 1;
if (moreThanOne) {
relatedReco = _.get(value, 'goods.data', []);
} else {
relatedReco = _.get(value, 'goods.data[0]', {});
}
finalDetail.push({
relatedReco: relatedReco
});
}
// 悬停浮动商品
if (_.get(value, 'goodsGroup.data', false)) {
console.log('^-^');
let collocation = [];
_.forEach(_.get(value, 'goodsGroup.data', []), item => {
let cover = _.get(item, 'cover', '');
collocation.push({
thumb: cover ?
helpers.image(cover.cover, 235, 314) : '',
type: cover ? getProductIcon(cover.maxSortId) : '',
goods: _.get(item, 'list', [])
});
});
finalDetail.push({
collocation: collocation
});
}
// 更多商品链接
... ... @@ -427,7 +453,7 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW
});
console.log(finalDetail);
console.log(JSON.stringify(finalDetail, 2, 2));
console.log('-------------------------------------------------------------------------');
return finalDetail;
};
... ...