Authored by HF

do modify product detail page call comments list api to old

@@ -67,12 +67,13 @@ class DetailData @@ -67,12 +67,13 @@ class DetailData
67 public static function consultList($productId, $pageNum, $pageSize) 67 public static function consultList($productId, $pageNum, $pageSize)
68 { 68 {
69 $param = Yohobuy::param(); 69 $param = Yohobuy::param();
70 - $param['method'] = 'h5.consult.li'; 70 + $param['method'] = 'app.comment.li';
71 $param['product_id'] = $productId; 71 $param['product_id'] = $productId;
72 $param['page'] = $pageNum; 72 $param['page'] = $pageNum;
73 $param['limit'] = $pageSize; 73 $param['limit'] = $pageSize;
74 $param['client_secret'] = Sign::getSign($param); 74 $param['client_secret'] = Sign::getSign($param);
75 75
  76 +
76 return Yohobuy::get(Yohobuy::API_URL, $param); 77 return Yohobuy::get(Yohobuy::API_URL, $param);
77 } 78 }
78 79
@@ -449,6 +449,11 @@ class DetailModel @@ -449,6 +449,11 @@ class DetailModel
449 449
450 /** 450 /**
451 * 获取评价列表 451 * 获取评价列表
  452 + *
  453 + * @param int $productId 产品ID
  454 + * @param int $pageNum 页码数
  455 + * @param int $pageSize 每页显示个数
  456 + * @return array
452 */ 457 */
453 public static function getComments($productId, $pageNum = 1, $pageSize = 300) 458 public static function getComments($productId, $pageNum = 1, $pageSize = 300)
454 { 459 {
@@ -456,13 +461,13 @@ class DetailModel @@ -456,13 +461,13 @@ class DetailModel
456 461
457 if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) { 462 if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
458 $commentList = DetailData::commentList($productId, $pageNum, $pageSize); 463 $commentList = DetailData::commentList($productId, $pageNum, $pageSize);
459 - if (!empty($commentList)) { 464 + if (!empty($commentList['data'])) {
460 $build = array(); 465 $build = array();
461 - foreach ($commentList as $value) {  
462 - $build['userName'] = '';  
463 - $build['desc'] = '';  
464 - $build['content'] = '';  
465 - $build['time'] = ''; 466 + foreach ($commentList['data'] as $value) {
  467 + $build['userName'] = $value['nickname'];
  468 + $build['desc'] = $value['color_name'] . '/' . $value['size_name'];
  469 + $build['content'] = $value['content'];
  470 + $build['time'] = $value['create_time'];
466 $result[] = $build; 471 $result[] = $build;
467 } 472 }
468 } 473 }