Authored by 郝肖肖

店铺装修 全部品类 通过brand €判断

@@ -29,6 +29,9 @@ class ShopModel @@ -29,6 +29,9 @@ class ShopModel
29 if (is_callable("self::$fun")) { 29 if (is_callable("self::$fun")) {
30 $list = self::$fun(self::getResourceData($list), $parameters); 30 $list = self::$fun(self::getResourceData($list), $parameters);
31 switch ($fun) { 31 switch ($fun) {
  32 + case 'signboard':
  33 + //过滤不合法的数据
  34 + break;
32 case 'newProducts': 35 case 'newProducts':
33 $data['newArrivel']['name'] = '新品上架 NEW'; 36 $data['newArrivel']['name'] = '新品上架 NEW';
34 $data['newArrivel']['list'] = $list; 37 $data['newArrivel']['list'] = $list;
@@ -80,7 +83,8 @@ class ShopModel @@ -80,7 +83,8 @@ class ShopModel
80 $urlList['product'] = SearchData::getProductUrl($searchCondition['condition']); 83 $urlList['product'] = SearchData::getProductUrl($searchCondition['condition']);
81 // 组合搜索分类url 84 // 组合搜索分类url
82 $sortCondition = array(); 85 $sortCondition = array();
83 - $sortCondition = $searchCondition['sortCondition']; 86 + $sortCondition['brand'] = self::getShopsBrandIds($shopId);
  87 +
84 if (isset($searchCondition['condition']['misort']) && !empty($searchCondition['condition']['misort'])) { 88 if (isset($searchCondition['condition']['misort']) && !empty($searchCondition['condition']['misort'])) {
85 $sortCondition['needSmallSort'] = 1; 89 $sortCondition['needSmallSort'] = 1;
86 } 90 }
@@ -135,6 +139,7 @@ class ShopModel @@ -135,6 +139,7 @@ class ShopModel
135 switch ($fun) { 139 switch ($fun) {
136 case 'newProducts': 140 case 'newProducts':
137 case 'hotProducts': 141 case 'hotProducts':
  142 + case 'signboard':
138 break; 143 break;
139 case 'goodsTabBar': 144 case 'goodsTabBar':
140 if (isset($list['hot'])) { 145 if (isset($list['hot'])) {
@@ -176,7 +181,7 @@ class ShopModel @@ -176,7 +181,7 @@ class ShopModel
176 $urlList['product'] = SearchData::getProductUrl($searchCondition['condition']); 181 $urlList['product'] = SearchData::getProductUrl($searchCondition['condition']);
177 // 组合搜索分类url 182 // 组合搜索分类url
178 $sortCondition = array(); 183 $sortCondition = array();
179 - $sortCondition = $searchCondition['sortCondition']; 184 + $sortCondition['brand'] = self::getShopsBrandIds($shopId);
180 if (isset($searchCondition['condition']['misort']) && !empty($searchCondition['condition']['misort'])) { 185 if (isset($searchCondition['condition']['misort']) && !empty($searchCondition['condition']['misort'])) {
181 $sortCondition['needSmallSort'] = 1; 186 $sortCondition['needSmallSort'] = 1;
182 } 187 }
@@ -715,12 +720,35 @@ class ShopModel @@ -715,12 +720,35 @@ class ShopModel
715 return $result; 720 return $result;
716 } 721 }
717 722
718 - 723 + /**
  724 + * 获取店铺下的品牌
  725 + * @param type $shopId 店铺id
  726 + * @return type []
  727 + */
719 public static function getShopsBrands($shopId) 728 public static function getShopsBrands($shopId)
720 { 729 {
721 - return ShopData::getShopsBrands($shopId); 730 + $result = ShopData::getShopsBrands($shopId);
  731 + return empty($result['data']) ? array() : $result['data'];
722 } 732 }
723 - 733 +
  734 + /**
  735 + * 获取店铺下的品牌id
  736 + * @param type $shopId 店铺id
  737 + * @return array []
  738 + */
  739 + public static function getShopsBrandIds($shopId)
  740 + {
  741 + $brands = array();
  742 + $result = self::getShopsBrands($shopId);
  743 + if (!empty($result)) {
  744 + foreach ($result as $val) {
  745 + $brands[] = $val['brand_id'];
  746 + }
  747 + }
  748 +
  749 + return implode(',', $brands);
  750 + }
  751 +
724 public static function getSearch($shopId) 752 public static function getSearch($shopId)
725 { 753 {
726 return ShopData::getSearch($shopId); 754 return ShopData::getSearch($shopId);
@@ -17,6 +17,11 @@ class IndexController extends WebAction @@ -17,6 +17,11 @@ class IndexController extends WebAction
17 */ 17 */
18 public function brandAction() 18 public function brandAction()
19 { 19 {
  20 + $shopId = $this->get('shopId', 0);
  21 + if (!empty($shopId)) {
  22 + $this->shopHome($shopId);
  23 + exit(0);
  24 + }
20 //品牌域名,没有获取到品牌域名的跳转首页 25 //品牌域名,没有获取到品牌域名的跳转首页
21 $domain = $this->param('named'); 26 $domain = $this->param('named');
22 if (empty($domain)) { 27 if (empty($domain)) {
@@ -31,7 +36,6 @@ class IndexController extends WebAction @@ -31,7 +36,6 @@ class IndexController extends WebAction
31 $type = intval(isset($result['type']) ? $result['type'] : ''); 36 $type = intval(isset($result['type']) ? $result['type'] : '');
32 switch ($type) { 37 switch ($type) {
33 case 1: 38 case 1:
34 - $shopId = $this->get('shopId', 0);  
35 if (empty($shopId)) { 39 if (empty($shopId)) {
36 //无单品店有多品店:1--->搜索页 40 //无单品店有多品店:1--->搜索页
37 $this->go('http://search.yohobuy.com/?query=' . $domain); 41 $this->go('http://search.yohobuy.com/?query=' . $domain);
@@ -355,19 +359,11 @@ class IndexController extends WebAction @@ -355,19 +359,11 @@ class IndexController extends WebAction
355 //店铺列表页 359 //店铺列表页
356 public function shopListAction() 360 public function shopListAction()
357 { 361 {
358 - //品牌域名,没有获取到品牌域名的跳转首页  
359 - $domain = $this->param('named');  
360 - if (empty($domain)) {  
361 - $this->go(SITE_MAIN);  
362 - }  
363 -  
364 - //根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页  
365 - $result = BrandsModel::getBrandByDomain($domain);  
366 - if (!$result) { 362 + $shopId = $this->get('shopId', 0);
  363 + if (empty($shopId)) {
367 $this->go(SITE_MAIN); 364 $this->go(SITE_MAIN);
368 } 365 }
369 366
370 - $shopId = empty($result['shopId']) ? $this->get('shopId', 0) : $result['shopId'];  
371 //获取uid 367 //获取uid
372 $uid = $this->getUid(); 368 $uid = $this->getUid();
373 369