Authored by 周少峰

modify 4.8 detail comment

@@ -498,23 +498,17 @@ class ItemModel @@ -498,23 +498,17 @@ class ItemModel
498 $result = array(); 498 $result = array();
499 if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) { 499 if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
500 $commentList = ItemData::commentList($productId, $pageNum, $pageSize); 500 $commentList = ItemData::commentList($productId, $pageNum, $pageSize);
501 - if (isset($commentList['code']) && $commentList['code'] === 200) { 501 + if (isset($commentList['code']) && $commentList['code'] === 200 && !empty($commentList['data']['pageResponse']['list'])) {
502 $build = array(); 502 $build = array();
503 - foreach ($commentList['data'] as $value) {  
504 - $headIco = ChannelConfig::$itemHeadDefaultImgIco;  
505 - if (!empty($value['head_ico'])) {  
506 - if (preg_match('@http://@', $value['head_ico'])) {  
507 - $headIco = preg_replace('@http:\/\/img(.+)\.static\.yhbimg\.com\/headimg@', 'http://head.static.yhbimg.com/yhb-head/', $value['head_ico']);  
508 - $headIco = Images::getImageUrl($headIco, 30, 30);  
509 - }  
510 - }  
511 - $build['avatar'] = $headIco;  
512 - $build['userName'] = $value['nickname'];  
513 - $build['color'] = $value['color_name'];  
514 - $build['size'] = $value['size_name']; 503 + foreach ($commentList['data']['pageResponse']['list'] as $value) {
  504 + $headIco = $value['userInfo']['headIco'] ? $value['userInfo']['headIco'] : ChannelConfig::$itemHeadDefaultImgIco;
  505 + $build['avatar'] = Images::getImageUrl($headIco, 30, 30);;
  506 + $build['userName'] = $value['userInfo']['nickName'];
  507 + $build['color'] = $value['goods']['color_name'];
  508 + $build['size'] = $value['goods']['size_name'];
515 $build['comment'] = isset($value['content']) ? $value['content'] : ''; 509 $build['comment'] = isset($value['content']) ? $value['content'] : '';
516 - $build['date'] = $value['create_time'];  
517 - $build['total'] = $value['total']; 510 + $build['date'] = $value['createTime'];
  511 + $build['total'] = $commentList['data']['pageResponse']['totalCount'];
518 $result[] = $build; 512 $result[] = $build;
519 } 513 }
520 } 514 }