Authored by Rock Zhang

添加商品咨询页面中常见问题的数据获取接口

Code Review By Rock Zhang
... ... @@ -88,6 +88,20 @@ class DetailData
}
/**
* 常见问题列表
*
* @return array
*/
public static function commonConsultList()
{
$param = Yohobuy::param();
$param['method'] = 'app.consult.common';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 评论内容列表
*
* @param int $productId 产品ID
... ...
... ... @@ -584,6 +584,24 @@ class DetailModel
}
/**
* 获取常见问题列表
*
* @return array
*/
public static function getCommonConsults()
{
$result = array();
$consults = DetailData::commonConsultList();
if (isset($consults['code']) && $consults['code'] === 200) {
$result['commonConsults'] = $consults['data'];
$consults = array();
}
return $result;
}
/**
* 咨询点赞
*
* @param int $uid 用户ID
... ...
... ... @@ -167,6 +167,25 @@ class DetailController extends AbstractAction
}
/*
* 异步获取咨询常见问题
*/
public function commonconsultsAction()
{
$result = array();
if ($this->isAjax()) {
$result = \Product\DetailModel::getCommonConsults();
}
if (empty($result)) {
echo ' ';
} else {
print_r($result);
$this->_view->display('common-consults', $result);
}
}
/*
* 咨询点赞
*/
public function consultupvoteAction()
... ...