Authored by uedxwg

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

@@ -73,6 +73,7 @@ class DetailData @@ -73,6 +73,7 @@ class DetailData
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
@@ -86,7 +87,15 @@ class DetailData @@ -86,7 +87,15 @@ class DetailData
86 */ 87 */
87 public static function commentList($productId, $pageNum, $pageSize) 88 public static function commentList($productId, $pageNum, $pageSize)
88 { 89 {
89 - // 暂未提供提口 90 + $param = Yohobuy::param();
  91 + $param['method'] = 'app.comment.li';
  92 + $param['product_id'] = $productId;
  93 + $param['page'] = $pageNum;
  94 + $param['limit'] = $pageSize;
  95 + $param['client_secret'] = Sign::getSign($param);
  96 +
  97 +
  98 + return Yohobuy::get(Yohobuy::API_URL, $param);
90 } 99 }
91 100
92 /** 101 /**
@@ -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 }
@@ -90,7 +90,7 @@ class DetailController extends AbstractAction @@ -90,7 +90,7 @@ class DetailController extends AbstractAction
90 'goodsCommentsPage' => true, 90 'goodsCommentsPage' => true,
91 'pageFooter' => true, 91 'pageFooter' => true,
92 'comments' => array( 92 'comments' => array(
93 - 'list' => \Product\DetailModel::getConsults($productId), 93 + 'list' => \Product\DetailModel::getComments($productId),
94 ), 94 ),
95 ); 95 );
96 96