Authored by yangyang

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

@@ -18,7 +18,7 @@ class BrandData @@ -18,7 +18,7 @@ class BrandData
18 { 18 {
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 = '/cmsproduct/service/v1/brands';
22 const URL_BRAND_FOLDER = '/cmsproduct/service/v1/brands'; 22 const URL_BRAND_FOLDER = '/cmsproduct/service/v1/brands';
23 const URL_BRAND_NODECONTENT = '/operations/service/v6/htmlcontent'; 23 const URL_BRAND_NODECONTENT = '/operations/service/v6/htmlcontent';
24 24
@@ -76,9 +76,9 @@ class BrandData @@ -76,9 +76,9 @@ class BrandData
76 * @param int $domain 品牌domain 76 * @param int $domain 品牌domain
77 * @return array 77 * @return array
78 */ 78 */
79 - public static function getBrandLogoByDomain($domain) 79 + public static function getBrandLogoByDomain($domain, $fields = 'less')
80 { 80 {
81 - 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, $fields));
82 } 82 }
83 83
84 /** 84 /**
@@ -82,7 +82,7 @@ class HelperSearch @@ -82,7 +82,7 @@ class HelperSearch
82 //一周新品上架 82 //一周新品上架
83 $result['leftContent'][]['newSales'] = isset($data['recent']) ? self::recentShelve($data['recent']['recent']) : array(); 83 $result['leftContent'][]['newSales'] = isset($data['recent']) ? self::recentShelve($data['recent']['recent']) : array();
84 //品牌banner 84 //品牌banner
85 - $result['brandBanner'] = isset($data['banner']) && isset($data['brand']) ? self::getBannerFormat($data['banner'],$data['brand']) : array(); 85 + $result['brandBanner'] = isset($data['brand']) ? self::getBannerFormat($data['brand'], $options['brandBanner']) : array();
86 //总记录数 86 //总记录数
87 $result['totalCount'] = $data['product']['total']; 87 $result['totalCount'] = $data['product']['total'];
88 //品牌店铺信息 88 //品牌店铺信息
@@ -1249,19 +1249,6 @@ class HelperSearch @@ -1249,19 +1249,6 @@ class HelperSearch
1249 return Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param); 1249 return Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
1250 } 1250 }
1251 1251
1252 - /**  
1253 - * 并行调接口url获取(获取品牌banner数据)  
1254 - */  
1255 - public static function getBannerUrl($customOptions = array())  
1256 - {  
1257 - // 构建必传参数  
1258 - $param = Yohobuy::param();  
1259 - $param['brand_id'] = $customOptions['brandId'];  
1260 - $param['method'] = 'app.brand.banner';  
1261 - $param['client_secret'] = Sign::getSign($param);  
1262 -  
1263 - return Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);  
1264 - }  
1265 1252
1266 1253
1267 /** 1254 /**
@@ -1339,13 +1326,12 @@ class HelperSearch @@ -1339,13 +1326,12 @@ class HelperSearch
1339 * 1326 *
1340 * @return array 品牌banner条数据 1327 * @return array 品牌banner条数据
1341 */ 1328 */
1342 - public static function getBannerFormat($banner, $brand) 1329 + public static function getBannerFormat($brand, $brandBanner)
1343 { 1330 {
1344 // 根据品牌Id获取品牌banner图 1331 // 根据品牌Id获取品牌banner图
1345 - if (isset($banner['banner'])) {  
1346 - $bannerImg = Helpers::getImageUrl($banner['banner'], '', 150);  
1347 - }  
1348 - 1332 + $bannerImg = Helpers::getImageUrl($brandBanner, '', 150);
  1333 + $brandHome = Helpers::url('/product/index/brand', '', $brand['brand_domain']);
  1334 + $brandIntro = Helpers::url('/product/index/brandIntro', '', $brand['brand_domain']);
1349 $is_favorite = false; 1335 $is_favorite = false;
1350 if(isset($brand['is_favorite'])){ 1336 if(isset($brand['is_favorite'])){
1351 // 获取是否收藏 1337 // 获取是否收藏
@@ -1360,7 +1346,9 @@ class HelperSearch @@ -1360,7 +1346,9 @@ class HelperSearch
1360 return array( 1346 return array(
1361 'bannerHeight' => '150', 1347 'bannerHeight' => '150',
1362 'coled' => $is_favorite, 1348 'coled' => $is_favorite,
1363 - 'banner' => $bannerImg 1349 + 'banner' => $bannerImg,
  1350 + 'brandHome' => $brandHome,
  1351 + 'brandIntro' => $brandIntro
1364 ); 1352 );
1365 } 1353 }
1366 1354
@@ -25,9 +25,9 @@ @@ -25,9 +25,9 @@
25 <div class="center-content clearfix"> 25 <div class="center-content clearfix">
26 {{> layout/path-nav}} 26 {{> layout/path-nav}}
27 27
28 - {{# brandAbout}} 28 + {{#if brandAbout}}
29 <div class="brand-about"> 29 <div class="brand-about">
30 - {{{brandIntro}}} 30 + {{{brandAbout}}}
31 </div> 31 </div>
32 {{^}} 32 {{^}}
33 <div class="list-left pull-left"> 33 <div class="list-left pull-left">
@@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
54 54
55 {{> product/latest-walk}} 55 {{> product/latest-walk}}
56 </div> 56 </div>
57 - {{/ brandAbout}} 57 + {{/if}}
58 </div> 58 </div>
59 {{/ list}} 59 {{/ list}}
60 </div> 60 </div>
@@ -71,7 +71,7 @@ class Bootstrap extends Bootstrap_Abstract @@ -71,7 +71,7 @@ class Bootstrap extends Bootstrap_Abstract
71 $controller = 'Index'; 71 $controller = 'Index';
72 $action = 'Index'; 72 $action = 'Index';
73 // 二级域名 73 // 二级域名
74 - if (2 === $level) { 74 + if (3 === $level) {
75 $url = strtolower($dispatcher->getRequest()->getRequestUri()); 75 $url = strtolower($dispatcher->getRequest()->getRequestUri());
76 if(empty($url) || $url == '/index' || $url == '/') { 76 if(empty($url) || $url == '/index' || $url == '/') {
77 $urlAction = '/index'; 77 $urlAction = '/index';
@@ -38,7 +38,7 @@ class BrandsModel @@ -38,7 +38,7 @@ class BrandsModel
38 $adNav = self::getAdNav($options['brandId']); 38 $adNav = self::getAdNav($options['brandId']);
39 $data['leftContent'][] = array('picLink' => $adNav); 39 $data['leftContent'][] = array('picLink' => $adNav);
40 40
41 - //获取静态内容(eg:20141219-100447) 41 + //获取静态内容
42 if ($options['node']) { 42 if ($options['node']) {
43 $nodeContent = HelperSearch::formatNodeContent($options['node']); 43 $nodeContent = HelperSearch::formatNodeContent($options['node']);
44 $data['leftContent'][]['picLink']['list'] = $nodeContent; 44 $data['leftContent'][]['picLink']['list'] = $nodeContent;
@@ -47,6 +47,43 @@ class BrandsModel @@ -47,6 +47,43 @@ class BrandsModel
47 return $data; 47 return $data;
48 } 48 }
49 49
  50 +
  51 +
  52 +
  53 +
  54 + /**
  55 + * 品牌介绍页
  56 + * @param array $customCondition
  57 + * @param array $customOptions
  58 + * @return array
  59 + */
  60 + public static function getBrandIntro($customCondition = array(), $customOptions = array())
  61 + {
  62 + $urlList = array();
  63 + //组合搜索品牌url
  64 + $urlList['brand'] = HelperSearch::getBrandUrl($customOptions);
  65 +
  66 + //批量调接口
  67 + $result = Yohobuy::getMulti($urlList, array(), true);
  68 +
  69 + if (isset($result['brand'])) {
  70 + $banner = HelperSearch::getBannerFormat($result['brand'], $customOptions['brandBanner']);
  71 + }
  72 +
  73 + return array(
  74 + 'brandBanner' => $banner,
  75 + 'brandAbout' => $customOptions['brandAbout']
  76 + );
  77 + }
  78 +
  79 +
  80 +
  81 +
  82 +
  83 +
  84 +
  85 +
  86 +
50 //获取品牌系列数据 87 //获取品牌系列数据
51 public static function getAdNav($brandId, $status = 1) 88 public static function getAdNav($brandId, $status = 1)
52 { 89 {
@@ -86,11 +123,10 @@ class BrandsModel @@ -86,11 +123,10 @@ class BrandsModel
86 //组合搜索品牌url 123 //组合搜索品牌url
87 $urlList['brand'] = HelperSearch::getBrandUrl($customOptions); 124 $urlList['brand'] = HelperSearch::getBrandUrl($customOptions);
88 125
89 - //组合获取品牌banner url  
90 - $urlList['banner'] = HelperSearch::getBannerUrl($customOptions);  
91 126
92 //组合用户浏览记录url 127 //组合用户浏览记录url
93 //$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']); 128 //$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);
  129 +
94 //批量调接口 130 //批量调接口
95 $result = Yohobuy::getMulti($urlList, array(), true); 131 $result = Yohobuy::getMulti($urlList, array(), true);
96 132
@@ -24,10 +24,13 @@ class IndexController extends WebAction @@ -24,10 +24,13 @@ class IndexController extends WebAction
24 } 24 }
25 $uid = $this->getUid(); 25 $uid = $this->getUid();
26 //根据品牌域名获取品牌id(同时判断品牌域名是否有效) 26 //根据品牌域名获取品牌id(同时判断品牌域名是否有效)
27 - $brandInfo = BrandData::getBrandLogoByDomain($domain);  
28 - if (!empty($brandInfo['data']) && $brandInfo['code'] === 200) { 27 + $fields = 'id,brand_name,brand_name_cn,brand_name_en,brand_domain,brand_alif,brand_banner,brand_ico,static_content_code';
  28 + $brandInfo = BrandData::getBrandLogoByDomain($domain, $fields);
  29 +
  30 + if (!empty($brandInfo['data']) && $brandInfo['code'] == 200) {
29 $brandId = $brandInfo['data']['id']; 31 $brandId = $brandInfo['data']['id'];
30 - $node = isset($brandInfo['static_content_code']) ? $brandInfo['static_content_code'] : false; 32 + $node = isset($brandInfo['data']['static_content_code']) ? $brandInfo['data']['static_content_code'] : false;
  33 + $brandBanner = $brandInfo['data']['brand_banner'];
31 } else { 34 } else {
32 $this->go(SITE_MAIN); 35 $this->go(SITE_MAIN);
33 } 36 }
@@ -42,6 +45,8 @@ class IndexController extends WebAction @@ -42,6 +45,8 @@ class IndexController extends WebAction
42 $options['uid'] = $uid; 45 $options['uid'] = $uid;
43 $options['brandId'] = $brandId; 46 $options['brandId'] = $brandId;
44 $options['node'] = $node; 47 $options['node'] = $node;
  48 + $options['brandBanner'] = $brandBanner;
  49 + $options['reviewNum'] = 6;
45 50
46 //调用模型获得数据 51 //调用模型获得数据
47 $data = Product\BrandsModel::getBrandSearchData($condition, $options); 52 $data = Product\BrandsModel::getBrandSearchData($condition, $options);
@@ -56,6 +61,51 @@ class IndexController extends WebAction @@ -56,6 +61,51 @@ class IndexController extends WebAction
56 $this->_view->display('list',$data); 61 $this->_view->display('list',$data);
57 } 62 }
58 63
  64 + //品牌介绍页
  65 + public function brandIntroAction()
  66 + {
  67 + //品牌域名
  68 + $domain = $this->param('named');
  69 + if (empty($domain)) {
  70 + $this->go(SITE_MAIN);
  71 + }
  72 + $uid = $this->getUid();
  73 + //根据品牌域名获取品牌id(同时判断品牌域名是否有效)
  74 + $fields = 'id,brand_name,brand_name_cn,brand_banner,brand_ico,brand_intro';
  75 + $brandInfo = BrandData::getBrandLogoByDomain($domain, $fields);
  76 +
  77 + if (!empty($brandInfo['data']) && $brandInfo['code'] == 200) {
  78 + $brandId = $brandInfo['data']['id'];
  79 + $brandBanner = $brandInfo['data']['brand_banner'];
  80 + $brandAbout = $brandInfo['data']['brand_intro'];
  81 + } else {
  82 + $this->go(SITE_MAIN);
  83 + }
  84 +
  85 + //品牌ID参数
  86 + $condition = array();
  87 + $condition['brand'] = $brandId;
  88 +
  89 + //$options参数数组
  90 + $options = array();
  91 + $options['brandName'] = $domain;
  92 + $options['uid'] = $uid;
  93 + $options['brandId'] = $brandId;
  94 + $options['brandBanner'] = $brandBanner;
  95 + $options['brandAbout'] = $brandAbout;
  96 + //调用模型获得数据
  97 + $data = Product\BrandsModel::getBrandIntro($condition, $options);
  98 +
  99 + $data = array(
  100 + //初始化js
  101 + 'searchListPage' => true,
  102 + 'list' => $data
  103 + );
  104 +
  105 + $this->setWebNavHeader();
  106 + //渲染模板
  107 + $this->_view->display('list',$data);
  108 + }
59 /** 109 /**
60 * 热销排行 110 * 热销排行
61 */ 111 */
@@ -9,7 +9,8 @@ class ListController extends WebAction @@ -9,7 +9,8 @@ class ListController extends WebAction
9 $positionId = 10; //搜素banner 位置id 9 $positionId = 10; //搜素banner 位置id
10 $condition = array(); 10 $condition = array();
11 $options = array( 11 $options = array(
12 - 'positionId' => $positionId 12 + 'positionId' => $positionId,
  13 + 'reviewNum' => 6
13 ); 14 );
14 $indexData = Product\IndexModel::getIndexData($condition, $options); 15 $indexData = Product\IndexModel::getIndexData($condition, $options);
15 16
@@ -31,7 +32,8 @@ class ListController extends WebAction @@ -31,7 +32,8 @@ class ListController extends WebAction
31 ); 32 );
32 $options = array( 33 $options = array(
33 'specialsale_id' => 'Y', 34 'specialsale_id' => 'Y',
34 - 'needDay' => 'Y' 35 + 'needDay' => 'Y',
  36 + 'reviewNum' => 6
35 ); 37 );
36 38
37 $newData = Product\NewModel::getNewSearchData($condition, $options); 39 $newData = Product\NewModel::getNewSearchData($condition, $options);
@@ -41,7 +41,8 @@ class SaleController extends WebAction @@ -41,7 +41,8 @@ class SaleController extends WebAction
41 41
42 $options = array( 42 $options = array(
43 'specialsale_id' => 'Y', 43 'specialsale_id' => 'Y',
44 - 'controller' => $this->_request->controller 44 + 'controller' => $this->_request->controller,
  45 + 'reviewNum' => 6
45 ); 46 );
46 47
47 $saleData = Product\SaleModel::getSaleSearchData($condition, $options, $specialInfo); 48 $saleData = Product\SaleModel::getSaleSearchData($condition, $options, $specialInfo);