Authored by Rock Zhang

为获取商品咨询列表数据接口添加用户id参数,从而获得用户是否已点击的数据

Code Review By Rock Zhang
@@ -64,16 +64,22 @@ class DetailData @@ -64,16 +64,22 @@ class DetailData
64 /** 64 /**
65 * 咨询内容列表 65 * 咨询内容列表
66 * 66 *
  67 + * @param int $uid 用户ID
67 * @param int $productId 产品ID 68 * @param int $productId 产品ID
68 * @param int $pageNum 页码数 69 * @param int $pageNum 页码数
69 * @param int $pageSize 每页显示个数 70 * @param int $pageSize 每页显示个数
70 * @return array 71 * @return array
71 */ 72 */
72 - public static function consultList($productId, $pageNum, $pageSize) 73 + public static function consultList($uid, $productId, $pageNum, $pageSize)
73 { 74 {
74 $param = Yohobuy::param(); 75 $param = Yohobuy::param();
75 $param['method'] = 'app.consult.li'; 76 $param['method'] = 'app.consult.li';
76 $param['product_id'] = $productId; 77 $param['product_id'] = $productId;
  78 +
  79 + if (!empty($uid)) {
  80 + $param['uid'] = $uid;
  81 + }
  82 +
77 $param['page'] = $pageNum; 83 $param['page'] = $pageNum;
78 $param['limit'] = $pageSize; 84 $param['limit'] = $pageSize;
79 $param['client_secret'] = Sign::getSign($param); 85 $param['client_secret'] = Sign::getSign($param);
@@ -549,18 +549,19 @@ class DetailModel @@ -549,18 +549,19 @@ class DetailModel
549 549
550 /** 550 /**
551 * 获取咨询列表 551 * 获取咨询列表
552 - * 552 + *
  553 + * @param int $uid 用户ID
553 * @param int $productId 产品ID 554 * @param int $productId 产品ID
554 * @param int $pageNum 页码数 555 * @param int $pageNum 页码数
555 * @param int $pageSize 每页显示个数 556 * @param int $pageSize 每页显示个数
556 * @return array 557 * @return array
557 */ 558 */
558 - public static function getConsults($productId, $pageNum = 1, $pageSize = 300) 559 + public static function getConsults($uid, $productId, $pageNum = 1, $pageSize = 300)
559 { 560 {
560 $result = array(); 561 $result = array();
561 562
562 if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) { 563 if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
563 - $consultList = DetailData::consultList($productId, $pageNum, $pageSize); 564 + $consultList = DetailData::consultList($uid, $productId, $pageNum, $pageSize);
564 if (isset($consultList['code']) && $consultList['code'] === 200) { 565 if (isset($consultList['code']) && $consultList['code'] === 200) {
565 $consultList = $consultList['data']['list']; 566 $consultList = $consultList['data']['list'];
566 $build = array(); 567 $build = array();
@@ -150,7 +150,8 @@ class DetailController extends AbstractAction @@ -150,7 +150,8 @@ class DetailController extends AbstractAction
150 } 150 }
151 $this->setTitle('购买咨询'); 151 $this->setTitle('购买咨询');
152 152
153 - $consults = \Product\DetailModel::getConsults($productId); 153 + $uid = $this->getUid();
  154 + $consults = \Product\DetailModel::getConsults($uid, $productId);
154 $data = array( 155 $data = array(
155 'goodsConsultsPage' => true, 156 'goodsConsultsPage' => true,
156 'pageFooter' => true, 157 'pageFooter' => true,