Authored by yangyang

修改代码写法

@@ -105,9 +105,9 @@ class HelperSearch @@ -105,9 +105,9 @@ class HelperSearch
105 //分类 105 //分类
106 $result['leftContent'][]['allSort'] = isset($filter['group_sort']) ? self::groupSort($filter['group_sort'], $options) : array(); 106 $result['leftContent'][]['allSort'] = isset($filter['group_sort']) ? self::groupSort($filter['group_sort'], $options) : array();
107 //一周新品上架 107 //一周新品上架
108 - $result['leftContent'][]['newSales'] = self::recentShelve($filter['recent']); 108 + //$result['leftContent'][]['newSales'] = self::recentShelve($filter['recent']);
109 //全部折扣 109 //全部折扣
110 - $result['leftContent'][]['allDiscount'] = self::getDiscount($filter['discount']); 110 + //$result['leftContent'][]['allDiscount'] = self::getDiscount($filter['discount']);
111 //总记录数 111 //总记录数
112 $result['totalCount'] = $data['data']['total']; 112 $result['totalCount'] = $data['data']['total'];
113 //分页 113 //分页
1 <?php 1 <?php
  2 +
2 namespace Product; 3 namespace Product;
3 4
4 use Plugin\Helpers; 5 use Plugin\Helpers;
  6 +use Plugin\HelperSearch;
5 use LibModels\Web\Product\BrandData; 7 use LibModels\Web\Product\BrandData;
6 use LibModels\Wap\Product\SearchData; 8 use LibModels\Wap\Product\SearchData;
7 use LibModels\Web\Product\SearchData as WebProduct; 9 use LibModels\Web\Product\SearchData as WebProduct;
@@ -11,15 +13,14 @@ use LibModels\Web\Product\SearchData as WebProduct; @@ -11,15 +13,14 @@ use LibModels\Web\Product\SearchData as WebProduct;
11 * 13 *
12 * @author Administrator 14 * @author Administrator
13 */ 15 */
14 -class BrandsModel  
15 -{ 16 +class BrandsModel {
16 17
17 const URL_BRAND_INDEX = '/product/index/brand'; 18 const URL_BRAND_INDEX = '/product/index/brand';
18 - 19 +
19 public static $shopName; 20 public static $shopName;
20 public static $home; 21 public static $home;
21 -  
22 - /** 22 +
  23 + /**
23 * 搜索品牌数据 24 * 搜索品牌数据
24 * 25 *
25 * @param $condition array 26 * @param $condition array
@@ -27,38 +28,52 @@ class BrandsModel @@ -27,38 +28,52 @@ class BrandsModel
27 * @param $options array 28 * @param $options array
28 * @return array 29 * @return array
29 */ 30 */
30 - public static function getBrandSearchData($condition, $options,$domain,$uid,$brandId)  
31 - {  
32 - 31 + public static function getBrandSearchData($condition, $options, $domain, $uid, $brandId) {
  32 +
33 // 调用商品搜索接口 33 // 调用商品搜索接口
34 $data = SearchData::searchElasticByCondition($condition); 34 $data = SearchData::searchElasticByCondition($condition);
35 -  
36 - //导航名  
37 - $brandName = self::$shopName;  
38 - $option['brandName'] = $brandName;  
39 -  
40 - //配置调用分类接口参数  
41 - $param = array();  
42 - $param['brand'] = $condition['brand'];  
43 - //获取分类列表数据  
44 - $classes = WebProduct::getClassesData($param);  
45 -  
46 - 35 + if (isset($data['code']) && $data['code'] === 200) {
  36 + //获取分类列表数据
  37 + $param = array();
  38 + $param['brand'] = $condition['brand'];
  39 + $classes = WebProduct::getClassesData($param);
  40 + if (isset($classes['code']) && $classes['code'] === 200) {
  41 + $data['data']['filter']['group_sort'] = $classes['data']['sort'];
  42 + }
  43 +
  44 + $brandName = self::$shopName;
  45 + $options['brandName'] = $brandName;
  46 +
  47 + //用户浏览记录
  48 + // 组织模板数据
  49 + $list = HelperSearch::getList($data, $options);
  50 + $data = array(
  51 + //初始化js
  52 + 'productListPage' => true,
  53 + 'list' => $list
  54 + );
  55 + } else {
  56 + $data = array();
  57 + }
  58 +
  59 + //获取品牌数据
  60 + $banner = self::getBannerByDomain($domain, $brandId, $uid = '');
  61 + $data = array_merge_recursive($data, $banner);
  62 +
  63 +
47 //获取品牌系列数据 64 //获取品牌系列数据
48 $adNav = self::getAdNav($condition['brand']); 65 $adNav = self::getAdNav($condition['brand']);
49 -  
50 -  
51 - //获取品牌数据  
52 - $banner = self::getBannerByDomain($domain, $brandId, $uid = '');  
53 -  
54 -  
55 - //开始组装数据  
56 -  
57 - 66 + $data['list']['leftContent'][] = array('picLink' => $adNav);
  67 +
  68 +
  69 +
  70 +
  71 +
  72 +
  73 +
58 return $data; 74 return $data;
59 } 75 }
60 -  
61 - 76 +
62 /** 77 /**
63 * 获取品牌首页banner条 78 * 获取品牌首页banner条
64 * @string $domain 品牌域名 79 * @string $domain 品牌域名
@@ -67,8 +82,7 @@ class BrandsModel @@ -67,8 +82,7 @@ class BrandsModel
67 * 82 *
68 * @return array 品牌banner条数据 83 * @return array 品牌banner条数据
69 */ 84 */
70 - public static function getBannerByDomain($domain, $brandId, $uid = '')  
71 - { 85 + public static function getBannerByDomain($domain, $brandId, $uid = '') {
72 // 构造品牌主页url 86 // 构造品牌主页url
73 self::$home = Helpers::url('', '', $domain) . self::URL_BRAND_INDEX; 87 self::$home = Helpers::url('', '', $domain) . self::URL_BRAND_INDEX;
74 // 根据品牌Id获取品牌banner图 88 // 根据品牌Id获取品牌banner图
@@ -83,9 +97,9 @@ class BrandsModel @@ -83,9 +97,9 @@ class BrandsModel
83 $is_favorite = false; 97 $is_favorite = false;
84 $logo = false; 98 $logo = false;
85 $shopName = false; 99 $shopName = false;
86 - 100 +
87 do { 101 do {
88 - if (! isset($intro['data'])) { 102 + if (!isset($intro['data'])) {
89 break; 103 break;
90 } 104 }
91 // 获取是否收藏 105 // 获取是否收藏
@@ -99,7 +113,7 @@ class BrandsModel @@ -99,7 +113,7 @@ class BrandsModel
99 // 获取品牌名 113 // 获取品牌名
100 self::$shopName = $intro['data']['brand_name']; 114 self::$shopName = $intro['data']['brand_name'];
101 } while (false); 115 } while (false);
102 - 116 +
103 // 返回banner数据 117 // 返回banner数据
104 return array( 118 return array(
105 'list' => array( 119 'list' => array(
@@ -127,22 +141,18 @@ class BrandsModel @@ -127,22 +141,18 @@ class BrandsModel
127 ); 141 );
128 } 142 }
129 143
130 -  
131 -  
132 //获取品牌系列数据 144 //获取品牌系列数据
133 - public static function getAdNav($brandId,$status = 1)  
134 - {//$condition['brand'] 145 + public static function getAdNav($brandId, $status = 1) {
135 //调用接口获得数据 146 //调用接口获得数据
136 - $advNav = BrandData::getFolderByBrand($brandId,$status); 147 + $advNav = BrandData::getFolderByBrand($brandId, $status);
137 $result = array(); 148 $result = array();
138 if (isset($advNav['data']) && $advNav['code'] === 200) { 149 if (isset($advNav['data']) && $advNav['code'] === 200) {
139 foreach ($advNav['data'] as $key => $value) { 150 foreach ($advNav['data'] as $key => $value) {
140 - $result['list'][$key]['href'] = self::$home . '?folder=' . $value['id']; 151 + $result['list'][$key]['href'] = self::$home . '?folder_id=' . $value['id'];
141 $result['list'][$key]['src'] = $value['brand_sort_ico']; 152 $result['list'][$key]['src'] = $value['brand_sort_ico'];
142 } 153 }
143 } 154 }
144 return $result; 155 return $result;
145 - //$data['list']['advNav'] = $result;  
146 } 156 }
147 - 157 +
148 } 158 }
1 <?php 1 <?php
2 namespace Product; 2 namespace Product;
3 3
4 -use Configs\CacheConfig;  
5 -use Plugin\HelperSearchNew;  
6 -use Plugin\Images;  
7 -use Plugin\Cache;  
8 use Plugin\HelperSearch; 4 use Plugin\HelperSearch;
9 use \LibModels\Web\Product\SearchData; 5 use \LibModels\Web\Product\SearchData;
10 6