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
xiaowei
9 years ago
Commit
3553a54286b60412df8f3307c020486ec20225d5
1 parent
6e217e61
品牌一览
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
36 deletions
yohobuy/www.yohobuy.com/application/controllers/Brands.php
yohobuy/www.yohobuy.com/application/models/Product/Brands.php
yohobuy/www.yohobuy.com/application/controllers/Brands.php
View file @
3553a54
...
...
@@ -2,6 +2,8 @@
use
Action\WebAction
;
use
Product\BrandsModel
;
use
LibModels\Web\Product\SearchData
;
use
Plugin\Helpers
;
/**
* 品牌首页
...
...
@@ -33,8 +35,7 @@ class BrandsController extends WebAction
/**
* 品牌接口数据
*
* @param
* string id 获取品牌ID
* @param string brandId 获取品牌ID
* @return json
*/
public
function
brandinfoAction
()
...
...
yohobuy/www.yohobuy.com/application/models/Product/Brands.php
View file @
3553a54
...
...
@@ -8,6 +8,8 @@ use LibModels\Web\Product\BrandData;
use
Index\HomeModel
;
use
Product\SearchModel
;
use
WebPlugin\Helpers
;
use
Plugin\Images
;
use
LibModels\Web\Product\SearchData
;
/**
* 品牌首页模板数据模型
...
...
@@ -46,11 +48,7 @@ class BrandsModel
return
$data
;
}
/**
* 品牌介绍页
* @param array $customCondition
...
...
@@ -62,43 +60,39 @@ class BrandsModel
$urlList
=
array
();
//组合搜索品牌url
$urlList
[
'brand'
]
=
HelperSearch
::
getBrandUrl
(
$customOptions
);
//批量调接口
$result
=
Yohobuy
::
getMulti
(
$urlList
,
array
(),
true
);
if
(
isset
(
$result
[
'brand'
]))
{
$banner
=
HelperSearch
::
getBannerFormat
(
$result
[
'brand'
],
$customOptions
[
'brandBanner'
]);
}
return
array
(
'brandBanner'
=>
$banner
,
'brandAbout'
=>
$customOptions
[
'brandAbout'
]
);
}
//根据品牌域名处理相关品牌参数
public
static
function
getBrandByDomain
(
$domain
,
$fields
)
{
{
$brandInfo
=
BrandData
::
getBrandLogoByDomain
(
$domain
,
$fields
);
$result
=
array
();
if
(
!
empty
(
$brandInfo
[
'data'
])
&&
$brandInfo
[
'code'
]
==
200
)
{
$result
[
'brandId'
]
=
isset
(
$brandInfo
[
'data'
][
'id'
])
?
$brandInfo
[
'data'
][
'id'
]
:
''
;
$result
[
'node'
]
=
isset
(
$brandInfo
[
'data'
][
'static_content_code'
])
?
$brandInfo
[
'data'
][
'static_content_code'
]
:
false
;
$result
[
'brandBanner'
]
=
isset
(
$brandInfo
[
'data'
][
'brand_banner'
])
?
$brandInfo
[
'data'
][
'brand_banner'
]
:
''
;
$result
[
'brandBanner'
]
=
isset
(
$brandInfo
[
'data'
][
'brand_banner'
])
?
$brandInfo
[
'data'
][
'brand_banner'
]
:
''
;
$result
[
'brandNameEn'
]
=
isset
(
$brandInfo
[
'data'
][
'brand_name_en'
])
?
$brandInfo
[
'data'
][
'brand_name_en'
]
:
''
;
$result
[
'brandNameCn'
]
=
isset
(
$brandInfo
[
'data'
][
'brand_name_cn'
])
?
$brandInfo
[
'data'
][
'brand_name_cn'
]
:
''
;
$result
[
'brandAbout'
]
=
isset
(
$brandInfo
[
'data'
][
'brand_intro'
])
?
$brandInfo
[
'data'
][
'brand_intro'
]
:
''
;
}
else
{
}
else
{
return
false
;
}
return
$result
;
}
//获取品牌系列数据
public
static
function
getAdNav
(
$brandId
,
$status
=
1
)
{
...
...
@@ -141,14 +135,13 @@ class BrandsModel
//组合用户浏览记录url
//$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);
//批量调接口
$result
=
Yohobuy
::
getMulti
(
$urlList
,
array
(),
true
);
//组织模板数据格式
$data
=
HelperSearch
::
getList
(
$result
,
$searchCondition
[
'options'
]);
return
$data
;
}
...
...
@@ -206,9 +199,9 @@ class BrandsModel
$brandList
[
$lk
]
=
$listTmp
;
}
//将brandList里的0-9 排序到最后
$numBrand
[
'0~9'
]
=
$brandList
[
'0~9'
];
unset
(
$brandList
[
'0~9'
]);
$brandList
+=
$numBrand
;
$numBrand
[
'0~9'
]
=
$brandList
[
'0~9'
];
unset
(
$brandList
[
'0~9'
]);
$brandList
+=
$numBrand
;
}
return
array
(
'brandTop'
=>
$brandTop
,
...
...
@@ -219,30 +212,48 @@ class BrandsModel
/*
* 获取单个广告浮窗内容
*/
public
static
function
getBrandInfo
(
$brandId
,
$uid
)
{
$data
=
array
();
$imgs
=
array
();
//获取品牌简介
$res
=
BrandData
::
getBrandIntro
(
$brandId
,
$uid
);
$condition
=
array
(
'viewNum'
=>
3
,
''
);
\LibModels\Web\Product\SearchData
::
searchElasticByCondition
(
$condition
);
if
(
isset
(
$res
[
'data'
])
&&
$res
[
'data'
])
{
$icoUrlTmp
=
explode
(
"?"
,
$res
[
'data'
][
'brand_ico'
])
;
//获取品牌下的产品信息
$proInfo
=
self
::
getProductByBrand
(
$brandId
);
$proInfoTmp
=
$proInfo
[
'data'
][
'product_list'
];
if
(
isset
(
$proInfoTmp
)
&&
$proInfoTmp
)
{
foreach
(
$proInfoTmp
as
$v
)
{
$imgs
[]
=
array
(
'src'
=>
Images
::
getImageUrl
(
$v
[
'default_images'
],
80
,
100
,
3
,
'goodsimg'
)
);
}
}
//整合
$data
=
array
(
'key'
=>
$res
[
'data'
][
'brand_id'
],
'icon'
=>
$icoUrlTmp
[
0
],
'title'
=>
$res
[
'data'
][
'brand_name'
],
'content'
=>
$res
[
'data'
][
'brand_intro'
],
'icon'
=>
Helpers
::
getImageUrl
(
$res
[
'data'
][
'brand_ico'
],
80
,
50
,
3
),
'title'
=>
$res
[
'data'
][
'brand_name'
],
'content'
=>
$res
[
'data'
][
'brand_intro'
],
'subtitle'
=>
'FEATURED ITEMS'
,
'imgs'
=>
array
(),
'imgs'
=>
$imgs
);
}
return
$data
;
}
/*
* 根据brandId获取产品信息
*/
public
static
function
getProductByBrand
(
$brandId
,
$num
=
3
)
{
$condition
[
'viewNum'
]
=
$num
;
$condition
[
'brand'
]
=
$brandId
;
return
searchData
::
searchElasticByCondition
(
$condition
);
}
/*
* 获取品牌一览资源位&channelType
*/
...
...
Please
register
or
login
to post a comment