Authored by 郭成尧

'访问路径筛选优化'

... ... @@ -12,11 +12,11 @@ class ListProcess
/**
* 返回商品和过滤数据
*
*
* @param $data
* @return array 处理之后的商品数据
*/
public static function getListData($data, $returnFilter = true, $showTag = true, $tagNew = true, $tagSale = true)
public static function getListData($data, $returnFilter = true, $showTag = true, $tagNew = true, $tagSale = true)
{
$result = array();
... ... @@ -32,7 +32,7 @@ class ListProcess
/**
* 处理列表商品数据
*
*
* @param $data
* @return array 处理之后的商品数据
*/
... ... @@ -50,7 +50,7 @@ class ListProcess
/**
* 处理筛选数据
*
*
* @param $data
* @param string | integer $gender 默认选择的性别,默认1,2,3表示所有
* @param null|string $exclude 需要排除的字段
... ... @@ -61,8 +61,18 @@ class ListProcess
// 过滤条件数据
$filters = array('classify' => array());
// 返回数据中有没有gender时要添加gender
$data['gender'] = array('2,3' => 'GIRLS', '1,3' => 'BOYS');
// tar modified 1606151500 返回数据中没有gender时要添加gender
switch ($gender) {
case '1,3':
$data['gender'] = array('1,3' => 'BOYS');
break;
case '2,3':
$data['gender'] = array('2,3' => 'GIRLS');
break;
default:
$data['gender'] = array('2,3' => 'GIRLS', '1,3' => 'BOYS');
break;
}
$num = 1;
foreach ($data as $key => $val) {
... ... @@ -180,18 +190,23 @@ class ListProcess
array(
'dataId' => '1,2,3',
'name' => '所有性别'
),
array(
'dataId' => '1,3',
'name' => 'BOYS'
),
array(
'dataId' => '2,3',
'name' => 'GIRLS'
),
)
)
);
// tar add 1606151500 处理性别参数
switch ($gender) {
case '1,3':
array_push($result['subs'], array('dataId' => '1,3', 'name' => 'BOYS'));
break;
case '2,3':
array_push($result['subs'], array('dataId' => '2,3', 'name' => 'GIRLS'));
break;
default:
array_push($result['subs'], array('dataId' => '1,3', 'name' => 'BOYS'), array('dataId' => '2,3', 'name' => 'GIRLS'));
break;
}
// 处理选中状态
foreach ($result['subs'] as &$val) {
if ($val['dataId'] === $gender) {
... ... @@ -306,10 +321,10 @@ class ListProcess
/**
* 按照数组中指定字段排序二维数组
*
* @param array &$array 需要排序的数组
* @param string $field 字段名称
* @param boolean $desc 时候降序排列,默认为false
*
* @param array &$array 需要排序的数组
* @param string $field 字段名称
* @param boolean $desc 时候降序排列,默认为false
*/
private static function sortArrByField(&$array, $field, $desc = false)
{
... ...