Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
hf
9 years ago
Commit
8934e3b8b1edb2832e1648be32abe2e28b90b2f6
1 parent
0b52cb95
do fixes bug to lifestyle maylike data empty filter
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
29 deletions
framework
library/LibModels/Wap/Product/RecomData.php
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Recom.php
framework
@
75bbc3b0
Subproject commit
119c247f5cf929aa1e059e40609bb16dd6b58f05
Subproject commit
75bbc3b075de19f239532f60c5995d06c5f814e2
...
...
library/LibModels/Wap/Product/RecomData.php
View file @
8934e3b
...
...
@@ -67,14 +67,43 @@ class RecomData
*/
public
static
function
mayLikeLifestyle
(
$page
=
1
,
$limit
=
50
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.search.lifeStyle'
;
$param
[
'page'
]
=
$page
;
$param
[
'limit'
]
=
$limit
;
$param
[
'yh_channel'
]
=
'4'
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
// $param = Yohobuy::param();
// $param['method'] = 'app.search.lifeStyle';
// $param['page'] = $page;
// $param['limit'] = $limit;
// $param['yh_channel'] = '4';
// $param['client_secret'] = Sign::getSign($param);
//
// return Yohobuy::get(Yohobuy::API_URL, $param);
// 人气单品
$param
=
array
(
array
(
'stocknumber'
=>
1
,
'status'
=>
1
,
'order'
=>
's_n_desc'
,
'viewNum'
=>
$limit
,
'msort'
=>
'10'
,
),
'N'
,
false
);
$result
[
'top'
]
=
Yohobuy
::
yarClient
(
Yohobuy
::
SERVICE_URL
.
'/search/service/v1/product'
,
'search'
,
$param
,
3600
);
// 缓存1小时
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
// 新品到着
$param
=
array
(
array
(
'status'
=>
1
,
'stocknumber'
=>
1
,
'gender'
=>
''
),
array
(
array
(
'misort'
=>
103
,
'viewNum'
=>
10
),
//数码3c
array
(
'misort'
=>
266
,
'viewNum'
=>
10
),
//居家
array
(
'misort'
=>
280
,
'viewNum'
=>
10
),
//玩具娱乐
array
(
'misort'
=>
101
,
'viewNum'
=>
10
),
//办公文具
array
(
'misort'
=>
259
,
'viewNum'
=>
10
),
//美妆
),
false
);
$result
[
'new'
]
=
Yohobuy
::
yarClient
(
Yohobuy
::
SERVICE_URL
.
'/search/service/v1/product'
,
'searchBySortList'
,
$param
,
3600
);
// 缓存1小时
return
$result
;
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Recom.php
View file @
8934e3b
...
...
@@ -47,8 +47,8 @@ class RecomController extends AbstractAction
if
(
empty
(
$recom
[
'data'
][
'product_list'
]))
{
break
;
}
/* 判断是否已没有数据 */
/* 判断是否已没有数据 */
if
(
intval
(
$page
)
>
intval
(
$recom
[
'data'
][
'page_total'
]))
{
break
;
}
...
...
@@ -59,7 +59,6 @@ class RecomController extends AbstractAction
$data
[
'goods'
][]
=
Helpers
::
formatProduct
(
$value
,
true
);
}
$this
->
_view
->
display
(
'maylike'
,
$data
);
}
while
(
false
);
echo
' '
;
...
...
@@ -120,32 +119,65 @@ class RecomController extends AbstractAction
if
(
!
$this
->
isAjax
())
{
break
;
}
/* 创意生活只有一页数据 */
$page
=
$this
->
get
(
'page'
,
1
);
if
(
intval
(
$page
)
>
1
)
{
break
;
}
/* 取可能喜欢的数据 */
$recom
=
RecomData
::
mayLikeLifestyle
();
if
(
empty
(
$recom
[
'data'
][
'product_list'
]))
{
/* 构建人气单品数据 */
if
(
empty
(
$recom
[
'top'
][
'data'
][
'product_list'
]))
{
break
;
}
/* 构建模板需要的商品数据 */
$data
=
array
();
$build
=
array
();
$build
[
'show'
]
=
true
;
foreach
(
$recom
[
'top'
][
'data'
][
'product_list'
]
as
$value
)
{
$build
[
'goods'
][]
=
Helpers
::
formatProduct
(
$value
,
true
,
false
,
false
);
}
$data
[
'goodsContainer'
][]
=
$build
;
/* 构建新品到着数据 */
if
(
empty
(
$recom
[
'new'
][
'data'
][
'product_list'
]))
{
break
;
}
$build
=
array
();
if
(
!
empty
(
$recom
[
'data'
][
'product_list'
][
'top'
]))
{
$build
=
array
();
$build
[
'show'
]
=
true
;
foreach
(
$recom
[
'data'
][
'product_list'
][
'top'
]
as
$value
)
{
$build
[
'goods'
][]
=
Helpers
::
formatProduct
(
$value
,
true
);
}
$data
[
'goodsContainer'
][]
=
$build
;
}
if
(
!
empty
(
$recom
[
'data'
][
'product_list'
][
'new'
]))
{
$build
=
array
();
foreach
(
$recom
[
'data'
][
'product_list'
][
'new'
]
as
$value
)
{
$build
[
'show'
]
=
false
;
$build
[
'goods'
][]
=
Helpers
::
formatProduct
(
$value
,
true
);
}
$data
[
'goodsContainer'
][]
=
$build
;
$build
[
'show'
]
=
true
;
foreach
(
$recom
[
'new'
][
'data'
][
'product_list'
]
as
$value
)
{
$build
[
'goods'
][]
=
Helpers
::
formatProduct
(
$value
,
true
,
false
,
false
);
}
$data
[
'goodsContainer'
][]
=
$build
;
// if (empty($recom['data']['product_list'])) {
// break;
// }
//
// /* 构建模板需要的商品数据 */
// $data = array();
// $build = array();
// if (!empty($recom['data']['product_list']['top'])) {
// $build = array();
// $build['show'] = true;
// foreach ($recom['data']['product_list']['top'] as $value) {
// $build['goods'][] = Helpers::formatProduct($value, true);
// }
// $data['goodsContainer'][] = $build;
// }
// if (!empty($recom['data']['product_list']['new'])) {
// $build = array();
// foreach ($recom['data']['product_list']['new'] as $value) {
// $build['show'] = false;
// $build['goods'][] = Helpers::formatProduct($value, true);
// }
// $data['goodsContainer'][] = $build;
// }
$this
->
_view
->
display
(
'maylikelife'
,
$data
);
}
while
(
false
);
...
...
Please
register
or
login
to post a comment