Authored by Rock Zhang

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

Code Review By Rock Zhang
... ... @@ -64,16 +64,22 @@ class DetailData
/**
* 咨询内容列表
*
* @param int $uid 用户ID
* @param int $productId 产品ID
* @param int $pageNum 页码数
* @param int $pageSize 每页显示个数
* @return array
*/
public static function consultList($productId, $pageNum, $pageSize)
public static function consultList($uid, $productId, $pageNum, $pageSize)
{
$param = Yohobuy::param();
$param['method'] = 'app.consult.li';
$param['product_id'] = $productId;
if (!empty($uid)) {
$param['uid'] = $uid;
}
$param['page'] = $pageNum;
$param['limit'] = $pageSize;
$param['client_secret'] = Sign::getSign($param);
... ...
... ... @@ -550,17 +550,18 @@ class DetailModel
/**
* 获取咨询列表
*
* @param int $uid 用户ID
* @param int $productId 产品ID
* @param int $pageNum 页码数
* @param int $pageSize 每页显示个数
* @return array
*/
public static function getConsults($productId, $pageNum = 1, $pageSize = 300)
public static function getConsults($uid, $productId, $pageNum = 1, $pageSize = 300)
{
$result = array();
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
$consultList = DetailData::consultList($productId, $pageNum, $pageSize);
$consultList = DetailData::consultList($uid, $productId, $pageNum, $pageSize);
if (isset($consultList['code']) && $consultList['code'] === 200) {
$consultList = $consultList['data']['list'];
$build = array();
... ...
... ... @@ -150,7 +150,8 @@ class DetailController extends AbstractAction
}
$this->setTitle('购买咨询');
$consults = \Product\DetailModel::getConsults($productId);
$uid = $this->getUid();
$consults = \Product\DetailModel::getConsults($uid, $productId);
$data = array(
'goodsConsultsPage' => true,
'pageFooter' => true,
... ...