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
郝肖肖
9 years ago
Commit
61ed17c001692d6384badff99de5a7056a758f62
1 parent
3848c489
日韩馆 你可能喜欢的接口
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
3 deletions
library/LibModels/Wap/Product/RecomData.php
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Recom.php
library/LibModels/Wap/Product/RecomData.php
View file @
61ed17c
...
...
@@ -36,7 +36,7 @@ class RecomData
$param
[
'yh_channel'
]
=
$channel
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
,
3
6
00
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
,
300
);
}
/**
...
...
@@ -55,7 +55,7 @@ class RecomData
$param
[
'yh_channel'
]
=
'3'
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
,
3
6
00
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
,
300
);
}
/**
...
...
@@ -74,7 +74,27 @@ class RecomData
$param
[
'yh_channel'
]
=
'4'
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
,
3600
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
,
300
);
}
/**
* 活动模板-商品列表接口
* @param type int $templateId 模板id
* @param type string $order 排序
* @param type int $page 页码
* @param type int $limit 条数
* @return type []
*/
public
static
function
newPreference
(
$templateId
,
$order
=
''
,
$page
=
1
,
$limit
=
50
)
{
$param
=
Yohobuy
::
param
();
$param
[
'template_id'
]
=
intval
(
$templateId
);
$param
[
'order'
]
=
$order
;
$param
[
'page'
]
=
$page
;
$param
[
'limit'
]
=
$limit
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
post
(
Yohobuy
::
SERVICE_URL
.
'operations/api/v5/activitytemplate/getProduct'
,
$param
,
300
);
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Recom.php
View file @
61ed17c
...
...
@@ -163,5 +163,47 @@ class RecomController extends AbstractAction
$this
->
_view
->
display
(
'maylikelife'
,
$data
);
}
/**
* 日韩馆-你可能喜欢的
*/
public
function
newPreferenceAction
()
{
$data
=
array
();
do
{
/* 判断是否是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
break
;
}
//模板id
$templateId
=
$this
->
get
(
'template_id'
,
0
);
/* 创意生活只有一页数据 */
$page
=
$this
->
get
(
'page'
,
1
);
if
(
intval
(
$page
)
>
1
||
empty
(
$templateId
))
{
break
;
}
/* 取可能喜欢的数据 */
$recom
=
json_decode
(
RecomData
::
newPreference
(
$templateId
),
true
);
/* 构建人气单品数据 */
if
(
empty
(
$recom
)
||
empty
(
$recom
[
'data'
][
'product_list'
]))
{
break
;
}
$data
=
array
();
$build
=
array
();
$build
[
'show'
]
=
true
;
foreach
(
$recom
[
'data'
][
'product_list'
]
as
$value
)
{
$build
[
'goods'
][]
=
Helpers
::
formatProduct
(
$value
,
true
,
false
,
false
);
}
$data
[
'goodsContainer'
][]
=
$build
;
}
while
(
false
);
$this
->
_view
->
display
(
'maylikelife'
,
$data
);
}
}
...
...
Please
register
or
login
to post a comment