Authored by yangyang

获取品牌folder

@@ -19,6 +19,8 @@ class BrandData @@ -19,6 +19,8 @@ class BrandData
19 19
20 const URI_BRAND_TOPPOS = 'operations/api/v5/resource/get'; 20 const URI_BRAND_TOPPOS = 'operations/api/v5/resource/get';
21 const URL_BRAND_LOGO = '/shops/service/v1/brand'; 21 const URL_BRAND_LOGO = '/shops/service/v1/brand';
  22 + const URL_BRAND_FOLDER = '/cmsproduct/service/v1/brands';
  23 + const URL_BRAND_NODECONTENT = '/operations/service/v6/htmlcontent';
22 24
23 /** 25 /**
24 * 获取品牌简介 26 * 获取品牌简介
@@ -68,7 +70,7 @@ class BrandData @@ -68,7 +70,7 @@ class BrandData
68 return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByids', array($brandId )); 70 return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByids', array($brandId ));
69 } 71 }
70 72
71 - /** 73 + /**
72 * 通过域名获取品牌LOGO信息 74 * 通过域名获取品牌LOGO信息
73 * 75 *
74 * @param int $domain 品牌domain 76 * @param int $domain 品牌domain
@@ -78,5 +80,27 @@ class BrandData @@ -78,5 +80,27 @@ class BrandData
78 { 80 {
79 return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByDomain', array($domain )); 81 return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByDomain', array($domain ));
80 } 82 }
81 - 83 +
  84 + /**
  85 + * 通过品牌id获取品牌Folder
  86 + *
  87 + * @param int $brand_id 品牌id
  88 + * @param int $status 状态
  89 + * @return array
  90 + */
  91 + public static function getFolderByBrand($brand_id,$status = 1)
  92 + {
  93 + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_FOLDER, 'getFolderByBrand', array($brand_id,$status ));
  94 + }
  95 +
  96 + /**
  97 + * 根据节点和运行模式选择静态内容
  98 + * @param $node 20141219-100447
  99 + * @param string $mode
  100 + * @return mixed
  101 + */
  102 + public static function getByNodeContent($node, $mode='release')
  103 + {
  104 + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_NODECONTENT, 'getByNodeContent', array($node, $mode));
  105 + }
82 } 106 }
@@ -3,7 +3,6 @@ namespace Product; @@ -3,7 +3,6 @@ namespace Product;
3 3
4 use Plugin\Helpers; 4 use Plugin\Helpers;
5 use LibModels\Web\Product\BrandData; 5 use LibModels\Web\Product\BrandData;
6 -use Product\SearchModel;  
7 6
8 /** 7 /**
9 * Description of Brands 8 * Description of Brands
@@ -13,9 +12,10 @@ use Product\SearchModel; @@ -13,9 +12,10 @@ use Product\SearchModel;
13 class BrandsModel 12 class BrandsModel
14 { 13 {
15 14
16 - const URL_BRAND_INDEX = '/product/brands/index'; 15 + const URL_BRAND_INDEX = '/product/index/brand';
17 16
18 public static $shopName; 17 public static $shopName;
  18 + public static $home;
19 /** 19 /**
20 * 获取品牌首页banner条 20 * 获取品牌首页banner条
21 * @string $domain 品牌域名 21 * @string $domain 品牌域名
@@ -27,7 +27,7 @@ class BrandsModel @@ -27,7 +27,7 @@ class BrandsModel
27 public static function getBannerByDomain($domain, $bannerId, $uid = '') 27 public static function getBannerByDomain($domain, $bannerId, $uid = '')
28 { 28 {
29 // 构造品牌主页url 29 // 构造品牌主页url
30 - $home = Helpers::url('', '', $domain) . self::URL_BRAND_INDEX; 30 + self::$home = Helpers::url('', '', $domain) . self::URL_BRAND_INDEX;
31 // 根据品牌Id获取品牌banner图 31 // 根据品牌Id获取品牌banner图
32 $bannerImg = BrandData::getBrandBanner($bannerId); 32 $bannerImg = BrandData::getBrandBanner($bannerId);
33 if (isset($bannerImg['data'])) { 33 if (isset($bannerImg['data'])) {
@@ -66,7 +66,7 @@ class BrandsModel @@ -66,7 +66,7 @@ class BrandsModel
66 'banner' => $bannerImg 66 'banner' => $bannerImg
67 ), 67 ),
68 'shopEntry' => array( 68 'shopEntry' => array(
69 - 'home' => $home, 69 + 'home' => self::$home,
70 'logo' => $logo, 70 'logo' => $logo,
71 'shopName' => self::$shopName, 71 'shopName' => self::$shopName,
72 'sort' => array( 72 'sort' => array(
@@ -99,6 +99,15 @@ class BrandsModel @@ -99,6 +99,15 @@ class BrandsModel
99 $classes['brand'] = $condition['brand']; 99 $classes['brand'] = $condition['brand'];
100 // 调用商品搜索接口 100 // 调用商品搜索接口
101 $data = \Product\SearchModel::getSearchData($condition, $options,$classes); 101 $data = \Product\SearchModel::getSearchData($condition, $options,$classes);
  102 + $advNav = BrandData::getFolderByBrand($condition['brand'],1);
  103 + $result = array();
  104 + if (isset($advNav['data']) && $advNav['code'] === 200) {
  105 + foreach ($advNav['data'] as $key => $value) {
  106 + $result['list'][$key]['href'] = self::$home . '?folder=' . $value['id'];
  107 + $result['list'][$key]['src'] = $value['brand_sort_ico'];
  108 + }
  109 + }
  110 + $data['list']['advNav'] = $result;
102 $shopName = self::$shopName; 111 $shopName = self::$shopName;
103 if(isset($data['list'])){ 112 if(isset($data['list'])){
104 $arr = array_chunk($data['list']['pathNav'],1); 113 $arr = array_chunk($data['list']['pathNav'],1);
@@ -107,6 +116,7 @@ class BrandsModel @@ -107,6 +116,7 @@ class BrandsModel
107 ); 116 );
108 } 117 }
109 $nav = array_merge_recursive($arr[0],$arr[1]); 118 $nav = array_merge_recursive($arr[0],$arr[1]);
  119 +
110 $data['list']['pathNav'] = $nav; 120 $data['list']['pathNav'] = $nav;
111 //删除品牌列表 121 //删除品牌列表
112 unset($data['list']['filters']['brand']); 122 unset($data['list']['filters']['brand']);
@@ -102,7 +102,6 @@ class IndexController extends WebAction @@ -102,7 +102,6 @@ class IndexController extends WebAction
102 $this->setWebNavHeader($cate[$gender-1]); 102 $this->setWebNavHeader($cate[$gender-1]);
103 //合并banner与搜索数据 103 //合并banner与搜索数据
104 $data = array_merge_recursive($data,$brandBanner); 104 $data = array_merge_recursive($data,$brandBanner);
105 - //删除搜索参数中的品牌选项  
106 //渲染模板 105 //渲染模板
107 $this->_view->display('list',$data); 106 $this->_view->display('list',$data);
108 } 107 }