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
郝肖肖
9 years ago
Commit
319cbedf45a95380a08fb1551f6b3aa2ff5f83bd
1 parent
81830418
店铺装修 潮流资讯
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
7 deletions
library/LibModels/Web/Guang/ListData.php
yohobuy/www.yohobuy.com/application/models/Product/Shop.php
yohobuy/www.yohobuy.com/application/modules/Product/controllers/Index.php
library/LibModels/Web/Guang/ListData.php
View file @
319cbed
...
...
@@ -129,4 +129,22 @@ class ListData
return
$result
;
}
/**
* 通过品牌获取相关文章
* @param type $brandId 品牌id
* @param type $limit 取推荐内容的数量
* @param type $udid
* @return type []
*/
public
static
function
getArticleByBrand
(
$brandId
,
$limit
,
$udid
=
''
)
{
$param
=
Yohobuy
::
param
();
$param
[
'brand_id'
]
=
$brandId
;
$param
[
'udid'
]
=
$udid
;
$param
[
'limit'
]
=
$limit
;
$param
[
'private_key'
]
=
Yohobuy
::
$privateKeyList
[
'web'
];
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
SERVICE_URL
.
'guang/service/v2/article/getArticleByBrand'
,
$param
);
}
}
...
...
yohobuy/www.yohobuy.com/application/models/Product/Shop.php
View file @
319cbed
...
...
@@ -591,19 +591,33 @@ class ShopModel
* @param type string $tag 搜索内容
* @return array []
*/
public
static
function
getArticle
(
$
tag
=
''
)
public
static
function
getArticle
(
$
shopId
)
{
$result
=
array
();
if
(
empty
(
$tag
))
{
$articleData
=
array
();
$brands
=
self
::
getShopsBrands
(
$shopId
);
if
(
empty
(
$brands
))
{
return
$result
;
}
foreach
(
$brands
as
$val
)
{
$article
=
GuangListData
::
getArticleByBrand
(
$val
[
'brand_id'
],
3
);
if
(
!
empty
(
$article
[
'data'
]))
{
$articleData
=
array_merge
(
$articleData
,
$article
[
'data'
]);
}
if
(
count
(
$articleData
)
>
3
)
{
break
;
}
}
$article
=
GuangListData
::
article
(
'1,2,3'
,
0
,
0
,
''
,
0
,
$tag
,
''
,
3
);
if
(
empty
(
$article
[
'data'
][
'list'
][
'artList'
]))
{
if
(
empty
(
$articleData
))
{
return
$result
;
}
foreach
(
$article
[
'data'
][
'list'
][
'artList'
]
as
$artList
)
{
foreach
(
$articleData
as
$key
=>
$artList
)
{
if
(
$key
>=
3
)
{
break
;
}
$result
[
'trendList'
][]
=
array
(
'href'
=>
$artList
[
'url'
],
'src'
=>
self
::
imageView2
(
substr
(
$artList
[
'src'
],
0
,
strpos
(
$artList
[
'src'
],
'?'
)),
264
,
173
),
...
...
@@ -611,7 +625,7 @@ class ShopModel
'Subtitle'
=>
$artList
[
'intro'
]
);
}
//等于3个才显示
if
(
count
(
$result
[
'trendList'
])
<
3
)
{
return
array
();
}
...
...
yohobuy/www.yohobuy.com/application/modules/Product/controllers/Index.php
View file @
319cbed
...
...
@@ -361,7 +361,7 @@ class IndexController extends WebAction
'shopIndexPage'
=>
true
,
'pathNav'
=>
false
,
// pathNav数据结构同其他页面
'coupon'
=>
false
,
// 先不做
'trendInfo'
=>
ShopModel
::
getArticle
(
$
domain
),
'trendInfo'
=>
ShopModel
::
getArticle
(
$
shopId
),
),
ShopModel
::
getData
(
$shopId
,
$parameters
)
);
...
...
Please
register
or
login
to post a comment