Authored by 周少峰

切换接口,屏蔽notice

@@ -34,16 +34,20 @@ class SearchData extends \LibModels\Wap\Product\SearchData @@ -34,16 +34,20 @@ class SearchData extends \LibModels\Wap\Product\SearchData
34 case 'developer': 34 case 'developer':
35 default: 35 default:
36 if ($type == 'sort') { 36 if ($type == 'sort') {
37 - return 'http://101.200.31.165/yohosearch/sortgroup.json'; 37 + //return 'http://101.200.31.165/yohosearch/sortgroup.json';
  38 + return 'http://192.168.10.64:8080/yohosearch/sortgroup.json';
38 } 39 }
39 elseif ($type == 'discount') { 40 elseif ($type == 'discount') {
40 - return 'http://101.200.31.165/yohosearch/discount.json'; 41 + //return 'http://101.200.31.165/yohosearch/discount.json';
  42 + return 'http://192.168.10.64:8080/yohosearch/discount.json';
41 } 43 }
42 elseif ($type == 'recent') { 44 elseif ($type == 'recent') {
43 - return 'http://101.200.31.165/yohosearch/recent.json'; 45 + //return 'http://101.200.31.165/yohosearch/recent.json';
  46 + return 'http://192.168.10.64:8080/yohosearch/recent.json';
44 } 47 }
45 elseif ($type == 'shop') { 48 elseif ($type == 'shop') {
46 - return 'http://101.200.31.165/yohosearch/shops.json'; 49 + //return 'http://101.200.31.165/yohosearch/shops.json';
  50 + return 'http://192.168.10.64:8080/yohosearch/shops.json';
47 } 51 }
48 // return 'http://101.200.31.165/yohosearch/search.json'; 52 // return 'http://101.200.31.165/yohosearch/search.json';
49 return 'http://192.168.10.64:8080/yohosearch/search-once.json'; 53 return 'http://192.168.10.64:8080/yohosearch/search-once.json';
@@ -59,19 +59,19 @@ class HelperSearch @@ -59,19 +59,19 @@ class HelperSearch
59 self::$options = $options; 59 self::$options = $options;
60 unset(self::$params['/']); 60 unset(self::$params['/']);
61 unset(self::$params['page']); 61 unset(self::$params['page']);
62 - self::$filter = $data['product']['filter']; 62 + self::$filter = isset($data['product']['filter']) ? $data['product']['filter'] : array();
63 //产品列表 63 //产品列表
64 - $result['goods'] = self::getProductList($data['product']['product_list'], $options['imgSize']); 64 + $result['goods'] = isset($data['product']['product_list']) ? self::getProductList($data['product']['product_list'], $options['imgSize']) : array();
65 //总页数 65 //总页数
66 - $result['page_total'] = $data['product']['page_total'];  
67 - self::$pageTotal = $data['product']['page_total']; 66 + $result['page_total'] = isset($data['product']['page_total']) ? $data['product']['page_total'] : '';
  67 + self::$pageTotal = $result['page_total'];
68 //当前页 68 //当前页
69 - $result['page'] = $data['product']['page']; 69 + $result['page'] = isset($data['product']['page']) ? $data['product']['page'] : '';
70 self::$page = $result['page']; 70 self::$page = $result['page'];
71 //筛选条件 71 //筛选条件
72 - $result['filters'] = self::filter(); 72 + $result['filters'] = isset($data['product']['filter']) ? self::filter() : array();
73 //排序方式、显示数量等其他选项 73 //排序方式、显示数量等其他选项
74 - $result['opts'] = self::getOpts(); 74 + $result['opts'] = isset($data['product']['filter']) ? self::getOpts() : array();
75 //下一页 75 //下一页
76 $result['hasNextPage'] = self::next($data['product']['page_total']); 76 $result['hasNextPage'] = self::next($data['product']['page_total']);
77 //全部折扣 77 //全部折扣
@@ -361,7 +361,6 @@ class HelperSearch @@ -361,7 +361,6 @@ class HelperSearch
361 $brandIds = isset($params['brand']) && !empty($params['brand']) ? explode(',', $params['brand']) : array(); 361 $brandIds = isset($params['brand']) && !empty($params['brand']) ? explode(',', $params['brand']) : array();
362 if (isset($filter['brand']) && !empty($filter['brand'])) { 362 if (isset($filter['brand']) && !empty($filter['brand'])) {
363 $brand = $filter['brand']; 363 $brand = $filter['brand'];
364 -// print_r($filter); exit;  
365 //已选中品牌数量 364 //已选中品牌数量
366 $existBrandNum = 0; 365 $existBrandNum = 0;
367 //已选中品牌标签名 366 //已选中品牌标签名
@@ -427,15 +426,20 @@ class HelperSearch @@ -427,15 +426,20 @@ class HelperSearch
427 if ($key && !in_array($key, $index_key) && !is_numeric($key)) { 426 if ($key && !in_array($key, $index_key) && !is_numeric($key)) {
428 $index['index'] = strtolower(($key)); 427 $index['index'] = strtolower(($key));
429 $index['name'] = $key; 428 $index['name'] = $key;
430 - $result['brandIndex'][] = $index;  
431 $index_key[] = $index; 429 $index_key[] = $index;
432 } 430 }
  431 + if ($key && !in_array($key, $index_key) && is_numeric($key) && count($result['brandIndex']) === 1) {
  432 + $index['index'] = '0-9';
  433 + $index['name'] = '0~9';
  434 + $result['brandIndex'][] = $index;
  435 + }
433 if (is_array($val)) { 436 if (is_array($val)) {
434 foreach ($val as $v) { 437 foreach ($val as $v) {
435 $result['brandsShow'][] = $v; 438 $result['brandsShow'][] = $v;
436 } 439 }
437 } 440 }
438 } 441 }
  442 + $result['brandIndex'] = array_merge($result['brandIndex'], $index_key);
439 unset($brandList); 443 unset($brandList);
440 } 444 }
441 //搜索页已选中,返回空 445 //搜索页已选中,返回空
@@ -148,13 +148,8 @@ class SearchModel @@ -148,13 +148,8 @@ class SearchModel
148 $urlList['sort'] = HelperSearch::getClassesUrl($searchCondition['sortCondition']); 148 $urlList['sort'] = HelperSearch::getClassesUrl($searchCondition['sortCondition']);
149 // 组合搜索折扣区间url 149 // 组合搜索折扣区间url
150 $urlList['discount'] = HelperSearch::getDiscountUrl($searchCondition['condition']); 150 $urlList['discount'] = HelperSearch::getDiscountUrl($searchCondition['condition']);
151 - // 组合搜索最新上架url  
152 - //$urlList['recent'] = HelperSearch::getRecentShelveUrl($searchCondition['condition']);  
153 - //用户浏览记录  
154 - //$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);  
155 151
156 $result = Yohobuy::getMulti($urlList, array(), true); 152 $result = Yohobuy::getMulti($urlList, array(), true);
157 -  
158 // 组织模板数据 153 // 组织模板数据
159 $data = HelperSearch::getList($result, $searchCondition['options']); 154 $data = HelperSearch::getList($result, $searchCondition['options']);
160 return $data; 155 return $data;
@@ -179,8 +174,6 @@ class SearchModel @@ -179,8 +174,6 @@ class SearchModel
179 $param['keyword'] = $searchCondition['condition']['query']; 174 $param['keyword'] = $searchCondition['condition']['query'];
180 $urlList['shop'] = HelperSearch::getShopUrl($param); 175 $urlList['shop'] = HelperSearch::getShopUrl($param);
181 } 176 }
182 - //用户浏览记录  
183 - //$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);  
184 $result = Yohobuy::getMulti($urlList, array(), true); 177 $result = Yohobuy::getMulti($urlList, array(), true);
185 // 组织模板数据 178 // 组织模板数据
186 $data = HelperSearch::getList($result, $searchCondition['options']); 179 $data = HelperSearch::getList($result, $searchCondition['options']);
@@ -229,7 +222,6 @@ class SearchModel @@ -229,7 +222,6 @@ class SearchModel
229 */ 222 */
230 public static function getSortSize($condition) 223 public static function getSortSize($condition)
231 { 224 {
232 - $size = array();  
233 //返回搜索条件 225 //返回搜索条件
234 $condition['needFilter'] = 1; 226 $condition['needFilter'] = 1;
235 $condition['viewNum'] = 1; 227 $condition['viewNum'] = 1;