...
|
...
|
@@ -73,10 +73,12 @@ class DetailModel |
|
|
}
|
|
|
}
|
|
|
|
|
|
// 商品咨询和商品评价
|
|
|
$result['feedbacks'] = array();
|
|
|
|
|
|
// 商品咨询
|
|
|
$result['feedbacks']['consultsNum'] = 0;
|
|
|
if (!empty($baseInfo['consultBoWrapper'])) {
|
|
|
$result['feedbacks']['consultsNum'] = '0';//empty($baseInfo['consultBoWrapper']['consultTotal']) ? '0' : $baseInfo['consultBoWrapper']['consultTotal'];
|
|
|
$result['feedbacks']['consultsNum'] = $baseInfo['consultBoWrapper']['consultTotal'];
|
|
|
$result['feedbacks']['consults'] = array();
|
|
|
$build = array();
|
|
|
foreach ($baseInfo['consultBoWrapper']['consultBoList'] as $value) {
|
...
|
...
|
@@ -85,9 +87,13 @@ class DetailModel |
|
|
$build['answer'] = $value['answer'];
|
|
|
$result['feedbacks']['consults'][] = $build;
|
|
|
}
|
|
|
$result['feedbacks']['link'] = Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $result['feedbacks']['consultsNum']));
|
|
|
}
|
|
|
|
|
|
// 商品评价
|
|
|
$result['feedbacks']['commentsNum'] = 0;
|
|
|
if (!empty($baseInfo['commentBoWrapper'])) {
|
|
|
$result['feedbacks']['commentsNum'] = '0';//empty($baseInfo['commentBoWrapper']['commentTotal']) ? '0' : $baseInfo['commentBoWrapper']['commentTotal'];
|
|
|
$result['feedbacks']['commentsNum'] = $baseInfo['commentBoWrapper']['commentTotal'];
|
|
|
$result['feedbacks']['comments'] = array();
|
|
|
$build = array();
|
|
|
foreach ($baseInfo['commentBoWrapper']['commentBoList'] as $value) {
|
...
|
...
|
@@ -97,6 +103,7 @@ class DetailModel |
|
|
$build['time'] = $value['createTime'];
|
|
|
$result['feedbacks']['comments'][] = $build;
|
|
|
}
|
|
|
$result['feedbacks']['link'] = Helpers::url('/product/detail/comments', array('product_id' => $productId, 'total' => $result['feedbacks']['commentsNum']));
|
|
|
}
|
|
|
|
|
|
// 品牌信息
|
...
|
...
|
@@ -323,10 +330,31 @@ class DetailModel |
|
|
|
|
|
/**
|
|
|
* 获取咨询列表
|
|
|
*
|
|
|
* @param int $productId 产品ID
|
|
|
* @param int $pageNum 页码数
|
|
|
* @param int $pageSize 每页显示个数
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function getConsults()
|
|
|
public static function getConsults($productId, $pageNum = 1, $pageSize = 100)
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
|
|
|
$consultList = DetailData::consultList($productId, $pageNum, $pageSize);
|
|
|
if (!empty($consultList)) {
|
|
|
$build = array();
|
|
|
foreach ($consultList as $value) {
|
|
|
$build['question'] = $value['ask'];
|
|
|
$build['time'] = $value['askTime'];
|
|
|
$build['answer'] = $value['answer'];
|
|
|
$result[] = $build;
|
|
|
}
|
|
|
}
|
|
|
$consultList = array();
|
|
|
}
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|