Authored by 周少峰

modify 4.8 detail comment

... ... @@ -498,23 +498,17 @@ class ItemModel
$result = array();
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
$commentList = ItemData::commentList($productId, $pageNum, $pageSize);
if (isset($commentList['code']) && $commentList['code'] === 200) {
if (isset($commentList['code']) && $commentList['code'] === 200 && !empty($commentList['data']['pageResponse']['list'])) {
$build = array();
foreach ($commentList['data'] as $value) {
$headIco = ChannelConfig::$itemHeadDefaultImgIco;
if (!empty($value['head_ico'])) {
if (preg_match('@http://@', $value['head_ico'])) {
$headIco = preg_replace('@http:\/\/img(.+)\.static\.yhbimg\.com\/headimg@', 'http://head.static.yhbimg.com/yhb-head/', $value['head_ico']);
$headIco = Images::getImageUrl($headIco, 30, 30);
}
}
$build['avatar'] = $headIco;
$build['userName'] = $value['nickname'];
$build['color'] = $value['color_name'];
$build['size'] = $value['size_name'];
foreach ($commentList['data']['pageResponse']['list'] as $value) {
$headIco = $value['userInfo']['headIco'] ? $value['userInfo']['headIco'] : ChannelConfig::$itemHeadDefaultImgIco;
$build['avatar'] = Images::getImageUrl($headIco, 30, 30);;
$build['userName'] = $value['userInfo']['nickName'];
$build['color'] = $value['goods']['color_name'];
$build['size'] = $value['goods']['size_name'];
$build['comment'] = isset($value['content']) ? $value['content'] : '';
$build['date'] = $value['create_time'];
$build['total'] = $value['total'];
$build['date'] = $value['createTime'];
$build['total'] = $commentList['data']['pageResponse']['totalCount'];
$result[] = $build;
}
}
... ...