Authored by Rock Zhang

修复热销排行榜数据错误的bug

... ... @@ -182,17 +182,19 @@ class NewsaleData
* 获取热销排行榜商品数据
*
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* $param integer $channel 1表示男,2表示女,3表示潮童,4表示创意生活
* @param string|null $sort 品类ID查询参数
* @param integer|null $tab_id Tab的ID
* @param integer $limit 查询返回的最大限制数, 默认为50
* @param integer $page 分页第几页, 默认第1页
* @return array 新品到着商品数据
*/
public static function getTopProducts($gender, $sort = null, $tab_id = null, $limit = 50, $page = 1)
public static function getTopProducts($gender, $channel, $sort = null, $tab_id = null, $limit = 50, $page = 1)
{
$param = Yohobuy::param();
$param['method'] = 'app.search.top';
$param['gender'] = $gender;
$param['yh_channel'] = $gender;
!empty($sort) && $param['sort'] = $sort;
!empty($tab_id) && $param['tab_id'] = $tab_id;
$param['page'] = $page;
... ...
... ... @@ -230,6 +230,7 @@ class NewsaleModel
* 筛选出来的热销排行榜商品数据处理
*
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* $param integer $channel 1表示男,2表示女,3表示潮童,4表示创意生活
* @param string|null $sort 品类ID查询参数
* @param integer|null $tab_id Tab的ID
* @param boolean $notab 时候返回顶部tab的数据,默认返回
... ... @@ -237,11 +238,11 @@ class NewsaleModel
* @param integer $page 分页第几页
* @return array 处理之后的数据
*/
public static function selectTopData($gender, $sort, $tab_id, $notab, $limit, $page)
public static function selectTopData($gender, $channel, $sort, $tab_id, $notab, $limit, $page)
{
$result = array();
$data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page);
$data = NewsaleData::getTopProducts($gender, $channel, $sort, $tab_id, $limit, $page);
if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) {
$result = NewSaleProcess::topData($data['data'], $notab, $limit, $page);
... ...
... ... @@ -110,7 +110,8 @@ class NewsaleController extends AbstractAction
// 获取性别
$gender = Helpers::getGenderByCookie();
$result = \Product\NewsaleModel::selectTopData($gender, $sort, $tab_id, $notab, $limit, $page);
$channel = Helpers::getChannelByCookie();
$result = \Product\NewsaleModel::selectTopData($gender, $channel, $sort, $tab_id, $notab, $limit, $page);
}
if (empty($result)) {
echo ' ';
... ...