Authored by yangyang

修改品牌页接口,修改浏览记录num,新增品牌介绍页

... ... @@ -18,7 +18,7 @@ class BrandData
{
const URI_BRAND_TOPPOS = 'operations/api/v5/resource/get';
const URL_BRAND_LOGO = '/shops/service/v1/brand';
const URL_BRAND_LOGO = '/cmsproduct/service/v1/brands';
const URL_BRAND_FOLDER = '/cmsproduct/service/v1/brands';
const URL_BRAND_NODECONTENT = '/operations/service/v6/htmlcontent';
... ... @@ -76,9 +76,9 @@ class BrandData
* @param int $domain 品牌domain
* @return array
*/
public static function getBrandLogoByDomain($domain)
public static function getBrandLogoByDomain($domain, $fields = 'less')
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByDomain', array($domain));
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByDomain', array($domain, $fields));
}
/**
... ...
... ... @@ -82,7 +82,7 @@ class HelperSearch
//一周新品上架
$result['leftContent'][]['newSales'] = isset($data['recent']) ? self::recentShelve($data['recent']['recent']) : array();
//品牌banner
$result['brandBanner'] = isset($data['banner']) && isset($data['brand']) ? self::getBannerFormat($data['banner'],$data['brand']) : array();
$result['brandBanner'] = isset($data['brand']) ? self::getBannerFormat($data['brand'], $options['brandBanner']) : array();
//总记录数
$result['totalCount'] = $data['product']['total'];
//品牌店铺信息
... ... @@ -1249,19 +1249,6 @@ class HelperSearch
return Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
}
/**
* 并行调接口url获取(获取品牌banner数据)
*/
public static function getBannerUrl($customOptions = array())
{
// 构建必传参数
$param = Yohobuy::param();
$param['brand_id'] = $customOptions['brandId'];
$param['method'] = 'app.brand.banner';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
}
/**
... ... @@ -1339,13 +1326,12 @@ class HelperSearch
*
* @return array 品牌banner条数据
*/
public static function getBannerFormat($banner, $brand)
public static function getBannerFormat($brand, $brandBanner)
{
// 根据品牌Id获取品牌banner图
if (isset($banner['banner'])) {
$bannerImg = Helpers::getImageUrl($banner['banner'], '', 150);
}
$bannerImg = Helpers::getImageUrl($brandBanner, '', 150);
$brandHome = Helpers::url('/product/index/brand', '', $brand['brand_domain']);
$brandIntro = Helpers::url('/product/index/brandIntro', '', $brand['brand_domain']);
$is_favorite = false;
if(isset($brand['is_favorite'])){
// 获取是否收藏
... ... @@ -1360,7 +1346,9 @@ class HelperSearch
return array(
'bannerHeight' => '150',
'coled' => $is_favorite,
'banner' => $bannerImg
'banner' => $bannerImg,
'brandHome' => $brandHome,
'brandIntro' => $brandIntro
);
}
... ...
... ... @@ -25,9 +25,9 @@
<div class="center-content clearfix">
{{> layout/path-nav}}
{{# brandAbout}}
{{#if brandAbout}}
<div class="brand-about">
{{{brandIntro}}}
{{{brandAbout}}}
</div>
{{^}}
<div class="list-left pull-left">
... ... @@ -54,7 +54,7 @@
{{> product/latest-walk}}
</div>
{{/ brandAbout}}
{{/if}}
</div>
{{/ list}}
</div>
... ...
... ... @@ -71,7 +71,7 @@ class Bootstrap extends Bootstrap_Abstract
$controller = 'Index';
$action = 'Index';
// 二级域名
if (2 === $level) {
if (3 === $level) {
$url = strtolower($dispatcher->getRequest()->getRequestUri());
if(empty($url) || $url == '/index' || $url == '/') {
$urlAction = '/index';
... ...
... ... @@ -38,7 +38,7 @@ class BrandsModel
$adNav = self::getAdNav($options['brandId']);
$data['leftContent'][] = array('picLink' => $adNav);
//获取静态内容(eg:20141219-100447)
//获取静态内容
if ($options['node']) {
$nodeContent = HelperSearch::formatNodeContent($options['node']);
$data['leftContent'][]['picLink']['list'] = $nodeContent;
... ... @@ -46,7 +46,44 @@ class BrandsModel
return $data;
}
/**
* 品牌介绍页
* @param array $customCondition
* @param array $customOptions
* @return array
*/
public static function getBrandIntro($customCondition = array(), $customOptions = array())
{
$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 getAdNav($brandId, $status = 1)
{
... ... @@ -86,18 +123,17 @@ class BrandsModel
//组合搜索品牌url
$urlList['brand'] = HelperSearch::getBrandUrl($customOptions);
//组合获取品牌banner url
$urlList['banner'] = HelperSearch::getBannerUrl($customOptions);
//组合用户浏览记录url
//$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);
//批量调接口
$result = Yohobuy::getMulti($urlList, array(), true);
//组织模板数据格式
$data = HelperSearch::getList($result, $searchCondition['options']);
return $data;
}
... ...
... ... @@ -24,10 +24,13 @@ class IndexController extends WebAction
}
$uid = $this->getUid();
//根据品牌域名获取品牌id(同时判断品牌域名是否有效)
$brandInfo = BrandData::getBrandLogoByDomain($domain);
if (!empty($brandInfo['data']) && $brandInfo['code'] === 200) {
$fields = 'id,brand_name,brand_name_cn,brand_name_en,brand_domain,brand_alif,brand_banner,brand_ico,static_content_code';
$brandInfo = BrandData::getBrandLogoByDomain($domain, $fields);
if (!empty($brandInfo['data']) && $brandInfo['code'] == 200) {
$brandId = $brandInfo['data']['id'];
$node = isset($brandInfo['static_content_code']) ? $brandInfo['static_content_code'] : false;
$node = isset($brandInfo['data']['static_content_code']) ? $brandInfo['data']['static_content_code'] : false;
$brandBanner = $brandInfo['data']['brand_banner'];
} else {
$this->go(SITE_MAIN);
}
... ... @@ -42,6 +45,8 @@ class IndexController extends WebAction
$options['uid'] = $uid;
$options['brandId'] = $brandId;
$options['node'] = $node;
$options['brandBanner'] = $brandBanner;
$options['reviewNum'] = 6;
//调用模型获得数据
$data = Product\BrandsModel::getBrandSearchData($condition, $options);
... ... @@ -56,6 +61,51 @@ class IndexController extends WebAction
$this->_view->display('list',$data);
}
//品牌介绍页
public function brandIntroAction()
{
//品牌域名
$domain = $this->param('named');
if (empty($domain)) {
$this->go(SITE_MAIN);
}
$uid = $this->getUid();
//根据品牌域名获取品牌id(同时判断品牌域名是否有效)
$fields = 'id,brand_name,brand_name_cn,brand_banner,brand_ico,brand_intro';
$brandInfo = BrandData::getBrandLogoByDomain($domain, $fields);
if (!empty($brandInfo['data']) && $brandInfo['code'] == 200) {
$brandId = $brandInfo['data']['id'];
$brandBanner = $brandInfo['data']['brand_banner'];
$brandAbout = $brandInfo['data']['brand_intro'];
} else {
$this->go(SITE_MAIN);
}
//品牌ID参数
$condition = array();
$condition['brand'] = $brandId;
//$options参数数组
$options = array();
$options['brandName'] = $domain;
$options['uid'] = $uid;
$options['brandId'] = $brandId;
$options['brandBanner'] = $brandBanner;
$options['brandAbout'] = $brandAbout;
//调用模型获得数据
$data = Product\BrandsModel::getBrandIntro($condition, $options);
$data = array(
//初始化js
'searchListPage' => true,
'list' => $data
);
$this->setWebNavHeader();
//渲染模板
$this->_view->display('list',$data);
}
/**
* 热销排行
*/
... ...
... ... @@ -9,7 +9,8 @@ class ListController extends WebAction
$positionId = 10; //搜素banner 位置id
$condition = array();
$options = array(
'positionId' => $positionId
'positionId' => $positionId,
'reviewNum' => 6
);
$indexData = Product\IndexModel::getIndexData($condition, $options);
... ... @@ -31,7 +32,8 @@ class ListController extends WebAction
);
$options = array(
'specialsale_id' => 'Y',
'needDay' => 'Y'
'needDay' => 'Y',
'reviewNum' => 6
);
$newData = Product\NewModel::getNewSearchData($condition, $options);
... ...
... ... @@ -41,7 +41,8 @@ class SaleController extends WebAction
$options = array(
'specialsale_id' => 'Y',
'controller' => $this->_request->controller
'controller' => $this->_request->controller,
'reviewNum' => 6
);
$saleData = Product\SaleModel::getSaleSearchData($condition, $options, $specialInfo);
... ...