Authored by 郭成尧

processArticleDetail-ok

@@ -410,12 +410,38 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW @@ -410,12 +410,38 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW
410 410
411 // 相关推荐 411 // 相关推荐
412 if (_.get(value, 'goods.data', false)) { 412 if (_.get(value, 'goods.data', false)) {
413 - console.log('^-^'); 413 + let relatedReco = [];
  414 + let moreThanOne = _.get(value, 'goods.data', []).length > 1;
  415 +
  416 + if (moreThanOne) {
  417 + relatedReco = _.get(value, 'goods.data', []);
  418 + } else {
  419 + relatedReco = _.get(value, 'goods.data[0]', {});
  420 + }
  421 +
  422 + finalDetail.push({
  423 + relatedReco: relatedReco
  424 + });
414 } 425 }
415 426
416 // 悬停浮动商品 427 // 悬停浮动商品
417 if (_.get(value, 'goodsGroup.data', false)) { 428 if (_.get(value, 'goodsGroup.data', false)) {
418 - console.log('^-^'); 429 + let collocation = [];
  430 +
  431 + _.forEach(_.get(value, 'goodsGroup.data', []), item => {
  432 + let cover = _.get(item, 'cover', '');
  433 +
  434 + collocation.push({
  435 + thumb: cover ?
  436 + helpers.image(cover.cover, 235, 314) : '',
  437 + type: cover ? getProductIcon(cover.maxSortId) : '',
  438 + goods: _.get(item, 'list', [])
  439 + });
  440 + });
  441 +
  442 + finalDetail.push({
  443 + collocation: collocation
  444 + });
419 } 445 }
420 446
421 // 更多商品链接 447 // 更多商品链接
@@ -427,7 +453,7 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW @@ -427,7 +453,7 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW
427 453
428 }); 454 });
429 455
430 - console.log(finalDetail); 456 + console.log(JSON.stringify(finalDetail, 2, 2));
431 console.log('-------------------------------------------------------------------------'); 457 console.log('-------------------------------------------------------------------------');
432 return finalDetail; 458 return finalDetail;
433 }; 459 };