...
|
...
|
@@ -5,6 +5,7 @@ namespace Product; |
|
|
use Api\Yohobuy;
|
|
|
use Plugin\HelperSearch;
|
|
|
use LibModels\Web\Product\BrandData;
|
|
|
use Index\HomeModel;
|
|
|
use Product\SearchModel;
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -14,6 +15,13 @@ use Product\SearchModel; |
|
|
*/
|
|
|
class BrandsModel
|
|
|
{
|
|
|
|
|
|
//品牌一览资源位CODE码
|
|
|
const BOYS_BRAND_CODE = '8b16b7baf9a66fbe553a6caa97d2ce2a';
|
|
|
const GIRLS_BRAND_CODE = 'c95ae9e40f0add10549b819f821ad626';
|
|
|
const KIDS_BRAND_CODE = '84b7926282fdef92f1039bdcf77c18ba';
|
|
|
const LIFESTYLE_BRAND_CODE = 'c575c6bfdfa4125fae7d24bbec7119c8';
|
|
|
|
|
|
/**
|
|
|
* 搜索品牌数据
|
|
|
* @param $condition array 搜索数据的条件
|
...
|
...
|
@@ -30,7 +38,7 @@ class BrandsModel |
|
|
$data['leftContent'][] = array('picLink' => $adNav);
|
|
|
|
|
|
//获取静态内容(eg:20141219-100447)
|
|
|
if($options['node']){
|
|
|
if ($options['node']) {
|
|
|
$nodeContent = HelperSearch::formatNodeContent($options['node']);
|
|
|
$data['leftContent'][]['picLink']['list'] = $nodeContent;
|
|
|
}
|
...
|
...
|
@@ -38,7 +46,6 @@ class BrandsModel |
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
|
|
|
//获取品牌系列数据
|
|
|
public static function getAdNav($brandId, $status = 1)
|
|
|
{
|
...
|
...
|
@@ -83,7 +90,6 @@ class BrandsModel |
|
|
|
|
|
//组合用户浏览记录url
|
|
|
//$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);
|
|
|
|
|
|
//批量调接口
|
|
|
$result = Yohobuy::getMulti($urlList, array(), true);
|
|
|
|
...
|
...
|
@@ -93,4 +99,124 @@ class BrandsModel |
|
|
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 获取品牌一览页面,品牌top & 列表
|
|
|
*/
|
|
|
|
|
|
public static function getBrandView($channel)
|
|
|
{
|
|
|
$switchParams = self::switchBrandParams($channel);
|
|
|
$brandTop = array();
|
|
|
/*
|
|
|
* $item1 = array(
|
|
|
'name' => '所有品牌',
|
|
|
'src' => $imgsrc,
|
|
|
'url' => ''
|
|
|
);
|
|
|
*/
|
|
|
$brandAds = array();
|
|
|
$brandList = array();
|
|
|
$res = BrandData::getTopBanner($switchParams['brandCode'], $switchParams['channelType']);
|
|
|
if (isset($res['brandTop'][0]['data']) && $res['brandTop'][0]['data']) {
|
|
|
foreach ($res['brandTop'][0]['data'] as $tk => $tv) {
|
|
|
$imgUrl = explode("?", $tv['src']);
|
|
|
$topTmp = array(
|
|
|
'name' => $tv['title'],
|
|
|
'src' => $imgUrl[0],
|
|
|
'url' => $tv['url'],
|
|
|
'items' => array()
|
|
|
);
|
|
|
$brandTop[$tk] = $topTmp;
|
|
|
}
|
|
|
}
|
|
|
if (isset($res['brandList']['brands']) && $res['brandList']['brands']) {
|
|
|
foreach ($res['brandList']['brands'] as $lk => $lv) {
|
|
|
if (isset($lv) && $lv) {
|
|
|
$listTmp = array();
|
|
|
foreach ($lv as $ltk => $ltv) {
|
|
|
$listTmp[$ltk] = array(
|
|
|
'name' => $ltv['brand_name'],
|
|
|
'key' => $ltv['id']
|
|
|
);
|
|
|
if ($ltv['is_hot'] == 'Y') {
|
|
|
$listTmp[$ltk] += array('hot' => 'hot');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$brandList[$lk] = $listTmp;
|
|
|
}
|
|
|
}
|
|
|
return array(
|
|
|
'brandTop' => $brandTop,
|
|
|
'brandList' => $brandList
|
|
|
);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 获取单个广告浮窗内容
|
|
|
*/
|
|
|
public static function getBrandInfo($brandId, $uid)
|
|
|
{
|
|
|
$imgsrc = 'http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg';
|
|
|
$data = array(
|
|
|
'key' => '1000011',
|
|
|
'icon' => $imgsrc,
|
|
|
'title' => '优显led触控台灯',
|
|
|
'content' => '优显led触控台灯优显led触控台灯优显led触控台灯优显led触控台灯',
|
|
|
'subtitle' => 'AAAAAA',
|
|
|
'imgs' => array(
|
|
|
array(
|
|
|
'src' => $imgsrc
|
|
|
),
|
|
|
array(
|
|
|
'src' => $imgsrc
|
|
|
),
|
|
|
array(
|
|
|
'src' => $imgsrc
|
|
|
)
|
|
|
)
|
|
|
);
|
|
|
$res = BrandData::getBrandIntro($brandId, $uid);
|
|
|
//if(isset($res['data']) && $res['data']){
|
|
|
// $data['key']=$brandId;
|
|
|
// $data['icon']=
|
|
|
//}
|
|
|
var_dump($res);
|
|
|
die();
|
|
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 获取品牌一览资源位&channelType
|
|
|
*/
|
|
|
|
|
|
public static function switchBrandParams($channelStr = 'boys')
|
|
|
{
|
|
|
$res = array('channelType' => 1, 'brandCode' => self::BOYS_BRAND_CODE);
|
|
|
switch ($channelStr) {
|
|
|
case HomeModel::COOKIE_NAME_BOYS:
|
|
|
$res['channelType'] = 1;
|
|
|
$res['brandCode'] = self::BOYS_BRAND_CODE;
|
|
|
break;
|
|
|
case HomeModel::COOKIE_NAME_GIRLS:
|
|
|
$res['channelType'] = 2;
|
|
|
$res['brandCode'] = self::GIRLS_BRAND_CODE;
|
|
|
break;
|
|
|
case HomeModel::COOKIE_NAME_KIDS:
|
|
|
$res['channelType'] = 3;
|
|
|
$res['brandCode'] = self::KIDS_BRAND_CODE;
|
|
|
break;
|
|
|
case HomeModel::COOKIE_NAME_LIFESTYLE:
|
|
|
$res['channelType'] = 4;
|
|
|
$res['brandCode'] = self::LIFESTYLE_BRAND_CODE;
|
|
|
break;
|
|
|
default:
|
|
|
$res['channelType'] = 1;
|
|
|
$res['brandCode'] = self::BOYS_BRAND_CODE;
|
|
|
break;
|
|
|
}
|
|
|
return $res;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|