Toggle navigation
Toggle navigation
This project
Loading...
Sign in
wangshusheng
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to dashboard
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
cailing
9 years ago
Commit
2daaf7ec6c70084ae570e2d797bb6a0cf5931944
1 parent
4da0a289
hotrank修改
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
44 deletions
yohobuy/www.yohobuy.com/application/models/Product/Hotrank.php
yohobuy/www.yohobuy.com/application/modules/Product/controllers/Index.php
yohobuy/www.yohobuy.com/application/models/Product/Hotrank.php
View file @
2daaf7e
...
...
@@ -8,10 +8,14 @@ use LibModels\Web\Product\SearchData;
use
LibModels\Web\Home\IndexData
;
use
WebPlugin\DataProcess\Channel
as
ChannelProcess
;
/*
* Hotrank页数据模型
*/
class
HotrankModel
{
/**
* 获取
热销排行
频道资源
* 获取频道资源
*
* @return array
*/
...
...
@@ -35,6 +39,70 @@ class HotrankModel {
}
}
/**
* 获取热销排行所有资源
* @param $data 频道信息
* @param $sid 一周热卖分类id
* @param $page 页码
* @return array
*/
static
public
function
HotrankResource
(
$data
,
$sid
,
$page
)
{
//焦点图 热门品牌
$focus
=
self
::
getFocusResource
(
$data
[
'channel'
],
$data
[
'code'
]);
$data
[
'hotrank'
][
'slide'
]
=
$focus
[
0
][
'slide'
];
$data
[
'hotrank'
][
'hotBrands'
]
=
$focus
[
1
][
'hotBrands'
];
//人气单品 一周热卖
$config
=
array
(
'sort'
=>
$sid
,
'gender'
=>
$data
[
'gender'
],
'road'
=>
$data
[
'road'
]);
$publiclist
=
self
::
getSearchData
(
$config
,
$page
,
0
);
$data
[
'hotrank'
][
'popular'
]
=
$publiclist
[
'popular'
];
$data
[
'hotrank'
][
'hotWeek'
]
=
$publiclist
[
'hotWeek'
];
//分类标签
$nav
=
HotrankModel
::
getHotranktag
(
'web'
,
$data
[
'road'
],
true
);
$data
[
'hotrank'
][
'hotWeek'
][
'nav'
]
=
$nav
;
return
$data
[
'hotrank'
];
}
/*
* 一周热卖加载更多
* @param $data 频道信息
* @param $sid 一周热卖分类id
* @param $page 页码
*/
static
public
function
getListData
(
$data
,
$sid
,
$page
)
{
$sort
=
''
;
//是否是默认标签
if
(
$sid
>
1
)
{
//通过ID获取标签信息
$info
=
HotrankData
::
getTagById
(
$sid
,
false
);
if
(
!
empty
(
$info
[
'data'
]))
{
$sort
=
$info
[
'data'
][
'category_id'
];
}
}
//获取频道资源
$channel
=
self
::
getChannelResource
();
//一周热卖
$config
=
array
(
'sort'
=>
$sort
,
'gender'
=>
$data
[
'gender'
],
'road'
=>
$data
[
'road'
]);
$list
=
self
::
getSearchData
(
$config
,
$page
,
1
);
$lister
=
$list
[
'hotWeek'
][
'list'
];
$lister
=
array_values
(
$lister
);
if
(
$sid
==
1
&&
$page
==
1
)
{
$lister
=
array_slice
(
$lister
,
10
,
50
);
}
else
{
$lister
=
array_slice
(
$lister
,
0
,
50
);
}
$data
=
array
(
'code'
=>
200
,
'data'
=>
$lister
,);
return
$data
;
}
/**
* 获取焦点图,热门品牌资源
...
...
yohobuy/www.yohobuy.com/application/modules/Product/controllers/Index.php
View file @
2daaf7e
...
...
@@ -3,7 +3,6 @@ use Action\WebAction;
use
LibModels\Web\Product\FavoriteData
;
use
Product\BrandsModel
;
use
LibModels\Web\Product\HotrankData
;
use
product\HotrankModel
;
class
IndexController
extends
WebAction
...
...
@@ -126,7 +125,7 @@ class IndexController extends WebAction
}
}
/**
/**
* 热销排行
*/
public
function
hotrankAction
()
...
...
@@ -134,27 +133,12 @@ class IndexController extends WebAction
//获取频道
$channel
=
HotrankModel
::
getChannelResource
();
$this
->
setWebNavHeader
(
$channel
[
'channel'
]);
$page
=
$this
->
get
(
'page'
,
1
);
$sort_id
=
$this
->
get
(
'sid'
,
0
);
$data
=
array
(
'hotrankPage'
=>
true
,
'footerTop'
=>
true
,
'hotrank'
=>
array
(
)
'hotrank'
=>
HotrankModel
::
HotrankResource
(
$channel
,
$sort_id
,
$page
)
);
//焦点图 热门品牌
$focus
=
HotrankModel
::
getFocusResource
(
$channel
[
'channel'
],
$channel
[
'code'
]);
$data
[
'hotrank'
][
'slide'
]
=
$focus
[
0
][
'slide'
];
$data
[
'hotrank'
][
'hotBrands'
]
=
$focus
[
1
][
'hotBrands'
];
//人气单品 一周热卖
$page
=
$this
->
get
(
'page'
,
1
);
$sort_id
=
$this
->
get
(
'sid'
,
0
);
$config
=
array
(
'sort'
=>
$sort_id
,
'gender'
=>
$channel
[
'gender'
],
'road'
=>
$channel
[
'road'
]);
$publiclist
=
HotrankModel
::
getSearchData
(
$config
,
$page
,
0
);
$data
[
'hotrank'
][
'popular'
]
=
$publiclist
[
'popular'
];
$data
[
'hotrank'
][
'hotWeek'
]
=
$publiclist
[
'hotWeek'
];
//分类标签
$nav
=
HotrankModel
::
getHotranktag
(
'web'
,
$channel
[
'road'
],
true
);
$data
[
'hotrank'
][
'hotWeek'
][
'nav'
]
=
$nav
;
$this
->
_view
->
display
(
'hotrank'
,
$data
);
}
...
...
@@ -171,31 +155,10 @@ class IndexController extends WebAction
exit
;
}
$sid
=
$this
->
get
(
'sid'
,
1
);
$sort
=
''
;
//是否是默认标签
if
(
$sid
>
1
)
{
//通过ID获取标签信息
$info
=
HotrankData
::
getTagById
(
$sid
,
false
);
if
(
!
empty
(
$info
[
'data'
]))
{
$sort
=
$info
[
'data'
][
'category_id'
];
}
}
//获取频道资源
$channel
=
HotrankModel
::
getChannelResource
();
//一周热卖
$config
=
array
(
'sort'
=>
$sort
,
'gender'
=>
$channel
[
'gender'
],
'road'
=>
$channel
[
'road'
]);
$list
=
HotrankModel
::
getSearchData
(
$config
,
$page
,
1
);
$lister
=
$list
[
'hotWeek'
][
'list'
];
$lister
=
array_values
(
$lister
);
if
(
$sid
==
1
&&
$page
==
1
)
{
$lister
=
array_slice
(
$lister
,
10
,
50
);
}
else
{
$lister
=
array_slice
(
$lister
,
0
,
50
);
}
$data
=
array
(
'code'
=>
200
,
'data'
=>
$lister
,);
//获取一周热卖资源
$data
=
HotrankModel
::
getListData
(
$channel
,
$sid
,
$page
);
echo
json_encode
(
$data
);
exit
;
}
...
...
Please
register
or
login
to post a comment