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
d9a85d3c0b54021ee1866ca5029f31a449a9753c
1 parent
d09fd795
增加列表页的处理逻辑
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
141 additions
and
12 deletions
framework
library/LibModels/Wap/Category/ClassData.php
library/Plugin/DataProcess/ListProcess.php
template/m.yohobuy.com/actions/product/list/list.phtml
yohobuy/m.yohobuy.com/application/modules/Product/controllers/List.php
framework
@
75bbc3b0
Subproject commit
119c247f5cf929aa1e059e40609bb16dd6b58f05
Subproject commit
75bbc3b075de19f239532f60c5995d06c5f814e2
...
...
library/LibModels/Wap/Category/ClassData.php
View file @
d9a85d3
...
...
@@ -47,8 +47,11 @@ class ClassData
* @param integer $channel 表示频道号,1位男生,2为女生
* @return array 品类商品数据
*/
public
static
function
select
Brand
Detail
(
$gender
,
$brand
,
$sort
,
$color
,
$size
,
$price
,
$p_d
,
$channel
=
1
,
$order
=
's_t_desc'
,
$limit
=
60
,
$page
=
1
)
public
static
function
select
Class
Detail
(
$gender
,
$brand
,
$sort
,
$color
,
$size
,
$price
,
$p_d
,
$channel
=
1
,
$order
=
's_t_desc'
,
$limit
=
60
,
$page
=
1
)
{
// 构建必传参数
$param
=
Yohobuy
::
param
();
$selectItems
=
array
(
'gender'
=>
$gender
,
'brand'
=>
$brand
,
...
...
@@ -60,9 +63,7 @@ class ClassData
);
// 拉取筛选参数
$queriedParams
=
array_filter
(
$selectItems
,
function
(
$v
)
{
return
$v
!==
null
;});
// 构建必传参数
$param
=
Yohobuy
::
param
();
$param
+=
$queriedParams
;
$param
[
'method'
]
=
'app.search.category'
;
$param
[
'page'
]
=
$page
;
...
...
library/Plugin/DataProcess/ListProcess.php
View file @
d9a85d3
...
...
@@ -63,6 +63,7 @@ class ListProcess
// 过滤条件数据
$filters
=
array
(
'classify'
=>
array
());
$num
=
1
;
foreach
(
$data
as
$key
=>
$val
)
{
if
(
empty
(
$val
))
{
...
...
@@ -72,6 +73,12 @@ class ListProcess
continue
;
}
$build
=
self
::
$key
(
$val
);
if
(
$num
===
1
)
{
$build
[
'active'
]
=
true
;
}
$num
++
;
$filters
[
'classify'
][]
=
$build
;
}
...
...
template/m.yohobuy.com/actions/product/list/list.phtml
0 → 100644
View file @
d9a85d3
{
{#
new
}
}
{
{>
good
}
}
{
{/
new
}
}
\ No newline at end of file
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/List.php
View file @
d9a85d3
...
...
@@ -3,6 +3,7 @@
use
Action\AbstractAction
;
use
LibModels\Wap\Product\SearchData
;
use
LibModels\Wap\Category\BrandData
;
use
LibModels\Wap\Category\ClassData
;
use
Plugin\DataProcess\ListProcess
;
use
Plugin\Helpers
;
...
...
@@ -11,33 +12,115 @@ use Plugin\Helpers;
*/
class
ListController
extends
AbstractAction
{
/**
* 搜索列表页
*/
public
function
indexAction
()
{
$data
=
array
(
'goodListPage'
=>
true
,
'goodList'
=>
array
(
)
);
$query
=
$this
->
get
(
'query'
,
null
);
$brand
=
$this
->
get
(
'brand'
,
null
);
$gender
=
$this
->
get
(
'gender'
,
null
);
$p_d
=
$this
->
get
(
'p_d'
,
null
);
$misort
=
$this
->
get
(
'misort'
,
null
);
$msort
=
$this
->
get
(
'msort'
,
null
);
$data
=
array
(
'pageHeader'
=>
array
(
'navBack'
=>
true
,
'navTitle'
=>
'搜索'
,
'navHome'
=>
'/'
),
'goodListPage'
=>
true
,
'goodList'
=>
array
()
);
// 如果存在搜索字符串就显示搜索栏
if
(
!
is_null
(
$query
))
{
$data
[
'search'
]
=
array
(
'default'
=>
$query
);
}
// 查询数据
$listData
=
SearchData
::
searchLiDatas
(
null
,
$brand
,
$gender
,
$p_d
,
$misort
,
$msort
);
$listData
=
SearchData
::
searchLiDatas
(
$query
,
$brand
,
$gender
,
$p_d
,
$misort
,
$msort
);
// 处理返回的数据
if
(
isset
(
$listData
[
'code'
])
&&
$listData
[
'code'
]
===
200
)
{
$tmpData
=
$listData
[
'data'
];
// 如果存在品牌信息就显示品牌字段
if
(
isset
(
$tmpData
[
'brand'
])
&&
!
empty
(
$tmpData
[
'brand'
]))
{
$brandData
=
$tmpData
[
'brand'
];
$data
[
'brandWay'
]
=
array
(
'url'
=>
'/product/list/brand?brand='
.
$brandData
[
'id'
],
'thumb'
=>
Helpers
::
getImageUrl
(
$brandData
[
'brand_ico'
],
75
,
40
),
'name'
=>
$brandData
[
'brand_name'
]
);
}
$data
[
'goodList'
]
=
ListProcess
::
getListData
(
$tmpData
);
}
$this
->
_view
->
display
(
'index'
,
$data
);
}
/**
* Ajax异步筛选请求
*/
public
function
searchAction
()
{
if
(
$this
->
isAjax
())
{
$query
=
$this
->
get
(
'query'
,
null
);
$brand
=
$this
->
get
(
'brand'
,
null
);
$gender
=
$this
->
get
(
'gender'
,
null
);
$p_d
=
$this
->
get
(
'p_d'
,
null
);
$misort
=
$this
->
get
(
'misort'
,
null
);
$msort
=
$this
->
get
(
'msort'
,
null
);
$order
=
$this
->
get
(
'order'
,
null
);
$type
=
$this
->
get
(
'type'
,
''
);
switch
(
$type
)
{
case
'price'
:
$order
=
(
$order
==
0
)
?
's_p_desc'
:
's_p_asc'
;
break
;
case
'discount'
:
$order
=
(
$order
==
0
)
?
'p_d_desc'
:
'p_d_asc'
;
break
;
case
'newest'
:
default
:
$order
=
(
$order
==
0
)
?
's_t_desc'
:
's_t_asc'
;
break
;
}
$data
=
array
();
// 查询数据
$listData
=
SearchData
::
searchLiDatas
(
$query
,
$brand
,
$gender
,
$p_d
,
$misort
,
$msort
,
$order
);
// 处理返回的数据
if
(
isset
(
$listData
[
'code'
])
&&
$listData
[
'code'
]
===
200
)
{
$tmpData
=
$listData
[
'data'
];
unset
(
$tmpData
[
'filter'
]);
// 不要筛选条件的数据
$data
=
ListProcess
::
getListData
(
$tmpData
);
}
if
(
empty
(
$data
))
{
echo
' '
;
}
else
{
$this
->
_view
->
display
(
'list'
,
$data
);
}
}
}
/**
* 品牌商品列表页
*/
public
function
brandAction
()
{
$brand
=
$this
->
get
(
'brand'
,
null
);
...
...
@@ -50,6 +133,7 @@ class ListController extends AbstractAction
$data
=
array
(
'pageHeader'
=>
array
(
'navBack'
=>
true
,
'navHome'
=>
'/'
),
'goodListPage'
=>
true
,
...
...
@@ -88,5 +172,39 @@ class ListController extends AbstractAction
$this
->
_view
->
display
(
'index'
,
$data
);
}
/**
* 品类商品列表页
*/
public
function
classAction
()
{
$brand
=
$this
->
get
(
'brand'
,
null
);
$gender
=
$this
->
get
(
'gender'
,
null
);
$sort
=
$this
->
get
(
'sort'
,
null
);
$color
=
$this
->
get
(
'color'
,
null
);
$size
=
$this
->
get
(
'size'
,
null
);
$price
=
$this
->
get
(
'price'
,
null
);
$p_d
=
$this
->
get
(
'p_d'
,
null
);
$data
=
array
(
'pageHeader'
=>
array
(
'navBack'
=>
true
,
'navHome'
=>
'/'
),
'goodListPage'
=>
true
,
'goodList'
=>
array
()
);
// 查询数据
$listData
=
ClassData
::
selectClassDetail
(
$gender
,
$brand
,
$sort
,
$color
,
$size
,
$price
,
$p_d
);
// 处理返回的数据
if
(
isset
(
$listData
[
'code'
])
&&
$listData
[
'code'
]
===
200
)
{
$tmpData
=
$listData
[
'data'
];
$data
[
'goodList'
]
=
ListProcess
::
getListData
(
$tmpData
);
}
$this
->
_view
->
display
(
'index'
,
$data
);
}
}
...
...
Please
register
or
login
to post a comment