Authored by Rock Zhang

修复热门排行的一些接口问题

... ... @@ -230,16 +230,27 @@ class NewsaleModel
/**
* 筛选出来的热销排行榜商品数据处理
*
* @param array $data 筛选出来的原数据
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param string|null $sort 品类ID查询参数
* @param integer|null $tab_id Tab的ID
* @param boolean $notab 时候返回顶部tab的数据,默认返回
* @param integer $limit 查询返回的最大限制数, 默认为50
* @param integer $page 分页第几页, 默认第1页
* @return array 处理之后的数据
*/
public static function selectTopData($data)
public static function selectTopData($gender, $sort, $tab_id, $notab, $limit, $page)
{
$result = array();
$data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page);
if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) {
$result = NewSaleProcess::newSaleData($data['data']);
unset($result['filter']);
if ($notab) {
unset($result['tabs']);
}
}
return $result;
... ...
... ... @@ -101,18 +101,17 @@ class NewsaleController extends AbstractAction
{
$result = array();
if ($this->isAjax()) {
// if ($this->isAjax()) {
$sort = $this->get('sort', null);
$tab_id = $this->get('tab_id', null);
$limit = $this->get('limit', 50);
$page = $this->get('page', 1);
$notab = (boolean)$this->get('notab', false);
// 获取性别
$gender = Helpers::getGenderByCookie();
$data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page);
$result = \Product\NewsaleModel::selectTopData($data);
}
$result = \Product\NewsaleModel::selectTopData($gender, $sort, $tab_id, $notab, $limit, $page);
// }
if (empty($result)) {
echo ' ';
... ...