Authored by Rock Zhang

Merge branch 'develop' into test

... ... @@ -53,9 +53,10 @@ class ListProcess
*
* @param $data
* @param string | integer $gender 默认选择的性别,默认1,2,3表示所有
* @param null|string $exclude 需要排除的字段
* @return array 处理之后的筛选数据
*/
public static function getFilterData($data, $gender = '1,2,3')
public static function getFilterData($data, $gender = '1,2,3', $exclude = null)
{
// 过滤条件数据
$filters = array('classify' => array());
... ... @@ -65,12 +66,10 @@ class ListProcess
$num = 1;
foreach ($data as $key => $val) {
if (empty($val)) {
continue;
}
if (!is_callable("self::$key")) {
if ($key === $exclude || empty($val) || !is_callable("self::$key")) {
continue;
}
$build = self::$key($val, $gender);
if ($num === 1) {
$build['active'] = true;
... ...
... ... @@ -52,13 +52,13 @@ goodsSwiper = new Swiper('.banner-swiper', {
//初始化goods-discount
if (0 === $('.goodsDiscount .discount-folder').children().length) {
if (0 === $discountFolder.children().length) {
$discountFolder.css('display', 'none');
$discountArrow.html('');
}
//goods-discount下拉按钮点击事件
if (goodsDiscountHammer) {
if (goodsDiscountHammer && $discountFolder.children().length > 0) {
goodsDiscountHammer.on('tap', function(e) {
if ($discountFolder.is(':hidden')) {
$discountArrow.removeClass('icon-down').addClass('icon-up').html('');
... ... @@ -67,7 +67,6 @@ if (goodsDiscountHammer) {
$discountArrow.removeClass('icon-up').addClass('icon-down').html('');
$discountFolder.slideUp();
}
return false;
});
}
... ...
... ... @@ -87,17 +87,26 @@ class SearchModel
}
}
// 设置选定的gender
$gender = '1,2,3';
if (isset($condition['gender'])) {
$gender = $condition['gender'];
}
// 区别各种列表页面的筛选数据
if (isset($condition['brand'])) {
$listData = BrandData::filterBrandData($condition);
$exclude = 'brand';
} else if (isset($condition['sort'])) {
$listData = ClassData::filterClassData($condition);
$exclude = 'group_sort';
} else {
$listData = SearchData::searchByCondition($condition);
$exclude = null;
}
if (isset($listData['data']['filter'])) {
$result['filter'] = ListProcess::getFilterData($listData['data']['filter']);
$result['filter'] = ListProcess::getFilterData($listData['data']['filter'], $gender, $exclude);
}
if (USE_CACHE) {
... ...