Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
Rock Zhang
9 years ago
Commit
285817958c8e10c77a1a74b7239f698e652f9a2c
1 parent
2d9ebc05
修复列表筛选数据错误的bug,目前品牌页面没有加brand参数
Code Reveiw By Rock Zhang
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
library/Plugin/DataProcess/ListProcess.php
yohobuy/m.yohobuy.com/application/models/Product/Search.php
library/Plugin/DataProcess/ListProcess.php
View file @
2858179
...
...
@@ -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
;
...
...
yohobuy/m.yohobuy.com/application/models/Product/Search.php
View file @
2858179
...
...
@@ -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
)
{
...
...
Please
register
or
login
to post a comment