Authored by Rock Zhang

修复新品到着,折扣专区性别默认选择错误的bug,修复折扣专区顶部banner不可配置的bug

... ... @@ -56,9 +56,10 @@ class ListProcess
* 处理筛选数据
*
* @param $data
* @param string | integer $gender 默认选择的性别,默认0表示所有
* @return array 处理之后的筛选数据
*/
public static function getFilterData($data)
public static function getFilterData($data, $gender = 0)
{
// 过滤条件数据
$filters = array('classify'=>array());
... ... @@ -72,7 +73,7 @@ class ListProcess
if (!is_callable("self::$key")) {
continue;
}
$build = self::$key($val);
$build = self::$key($val, $gender);
if($num === 1)
{
$build['active'] = true;
... ... @@ -173,7 +174,7 @@ class ListProcess
return $result;
}
private static function gender($data)
private static function gender($data, $gender)
{
$result = array(
'title' => '性别',
... ... @@ -182,8 +183,7 @@ class ListProcess
'dataType' => 'gender',
'subs' => array(
array(
'chosed' => true,
'dataId' => 0,
'dataId' => '1,2,3',
'name' => '所有性别'
),
array(
... ... @@ -197,6 +197,11 @@ class ListProcess
)
);
// 处理选中状态
foreach ($result['subs'] as &$val) {
$val['dataId'] === $gender && $val['chosed'] = true;
}
return $result;
}
... ...
... ... @@ -225,15 +225,16 @@ class NewsaleModel
/**
* 获取筛选数据
* @param array $data 接口返回的数据
* @param string $gender 默认选择的性别,默认1,2,3表示所有
* @return array 处理之后的数据
*/
public static function filterData($data)
public static function filterData($data, $gender = '1,2,3')
{
$result = array();
/* 格式化筛选数据 */
if (isset($data['code']) && $data['code'] == 200 && isset($data['data']['filter'])) {
$result['filter'] = ListProcess::getFilterData($data['data']['filter']);
$result['filter'] = ListProcess::getFilterData($data['data']['filter'], $gender);
}
return $result;
... ...
... ... @@ -53,7 +53,7 @@ class NewsaleController extends AbstractAction
// 设置一些默认参数
$data = array(
'discountPage' => true,
'headerBanner' => \Product\NewsaleModel::getNewFocus($channel),
'headerBanner' => \Product\NewsaleModel::getSaleFocus($channel),
'showDownloadApp' => true,
'pageFooter' => true,
'brand' => '0',
... ... @@ -140,7 +140,7 @@ class NewsaleController extends AbstractAction
$data = NewsaleData::selectNewSaleProducts(
$gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order
);
$result = \Product\NewsaleModel::filterData($data);
$result = \Product\NewsaleModel::filterData($data, $gender);
}
if (empty($result)) {
... ...