Authored by Rock Zhang

修改商品咨询列表数据获取接口为app.consult.li(便于和app.consult.like和app.consult.useful同步)

Code Review By Rock Zhang
@@ -72,7 +72,7 @@ class DetailData @@ -72,7 +72,7 @@ class DetailData
72 public static function consultList($productId, $pageNum, $pageSize) 72 public static function consultList($productId, $pageNum, $pageSize)
73 { 73 {
74 $param = Yohobuy::param(); 74 $param = Yohobuy::param();
75 - $param['method'] = 'h5.consult.li'; 75 + $param['method'] = 'app.consult.li';
76 $param['product_id'] = $productId; 76 $param['product_id'] = $productId;
77 $param['page'] = $pageNum; 77 $param['page'] = $pageNum;
78 $param['limit'] = $pageSize; 78 $param['limit'] = $pageSize;
@@ -561,16 +561,17 @@ class DetailModel @@ -561,16 +561,17 @@ class DetailModel
561 561
562 if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) { 562 if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
563 $consultList = DetailData::consultList($productId, $pageNum, $pageSize); 563 $consultList = DetailData::consultList($productId, $pageNum, $pageSize);
564 - if (!empty($consultList)) { 564 + if (isset($consultList['code']) && $consultList['code'] === 200) {
  565 + $consultList = $consultList['data']['list'];
565 $build = array(); 566 $build = array();
566 foreach ($consultList as $value) { 567 foreach ($consultList as $value) {
567 $build['question'] = $value['ask']; 568 $build['question'] = $value['ask'];
568 - $build['time'] = $value['askTime']; 569 + $build['time'] = $value['ask_time'];
569 $build['answer'] = $value['answer']; 570 $build['answer'] = $value['answer'];
570 $build['id'] = $value['id']; 571 $build['id'] = $value['id'];
571 - $build['isLike'] = $value['isLike']; 572 + $build['isLike'] = $value['is_like'] === 'Y';
572 $build['like'] = $value['like']; 573 $build['like'] = $value['like'];
573 - $build['isUseful'] = $value['isUseful']; 574 + $build['isUseful'] = $value['is_useful'] === 'Y';
574 $build['useful'] = $value['useful']; 575 $build['useful'] = $value['useful'];
575 $result[] = $build; 576 $result[] = $build;
576 } 577 }
@@ -626,7 +627,7 @@ class DetailModel @@ -626,7 +627,7 @@ class DetailModel
626 $result = array('code' => 400, 'message' => '出错啦~'); 627 $result = array('code' => 400, 'message' => '出错啦~');
627 628
628 do { 629 do {
629 - $record = DetailData::upvoteConsult($uid, $id); 630 + $record = DetailData::usefulConsult($uid, $id);
630 631
631 if (empty($uid)) { 632 if (empty($uid)) {
632 $result['code'] = 401; 633 $result['code'] = 401;
@@ -193,7 +193,7 @@ class DetailController extends AbstractAction @@ -193,7 +193,7 @@ class DetailController extends AbstractAction
193 $productId = $this->get('product_id', 0); 193 $productId = $this->get('product_id', 0);
194 $uid = $this->getUid(); 194 $uid = $this->getUid();
195 $id = $this->post('id'); 195 $id = $this->post('id');
196 - $result = \Product\DetailModel::upvoteConsult($uid, $id, $productId); 196 + $result = \Product\DetailModel::usefulConsult($uid, $id, $productId);
197 } 197 }
198 198
199 $this->echoJson($result); 199 $this->echoJson($result);