Authored by 周少峰

修改接口地址

@@ -39,26 +39,26 @@ class SearchData extends \LibModels\Wap\Product\SearchData @@ -39,26 +39,26 @@ class SearchData extends \LibModels\Wap\Product\SearchData
39 default: 39 default:
40 if ($type == 'sort') { 40 if ($type == 'sort') {
41 //return 'http://101.200.31.165/yohosearch/sortgroup.json'; 41 //return 'http://101.200.31.165/yohosearch/sortgroup.json';
42 - return 'http://192.168.10.64:8080/yohosearch/sortgroup.json'; 42 + return 'http://182.92.99.119:8080/yohosearch/sortgroup.json';
43 } 43 }
44 elseif ($type == 'discount') { 44 elseif ($type == 'discount') {
45 //return 'http://101.200.31.165/yohosearch/discount.json'; 45 //return 'http://101.200.31.165/yohosearch/discount.json';
46 - return 'http://192.168.10.64:8080/yohosearch/discount.json'; 46 + return 'http://182.92.99.119:8080/yohosearch/discount.json';
47 } 47 }
48 elseif ($type == 'recent') { 48 elseif ($type == 'recent') {
49 //return 'http://101.200.31.165/yohosearch/recent.json'; 49 //return 'http://101.200.31.165/yohosearch/recent.json';
50 - return 'http://192.168.10.64:8080/yohosearch/recent.json'; 50 + return 'http://182.92.99.119:8080/yohosearch/recent.json';
51 } 51 }
52 elseif ($type == 'suggest') { 52 elseif ($type == 'suggest') {
53 // return 'http://101.200.31.165/yohosearch/suggest.json'; 53 // return 'http://101.200.31.165/yohosearch/suggest.json';
54 - return 'http://192.168.10.64:8080/yohosearch/suggest.json'; 54 + return 'http://182.92.99.119:8080/yohosearch/suggest.json';
55 } 55 }
56 elseif ($type == 'shop') { 56 elseif ($type == 'shop') {
57 //return 'http://101.200.31.165/yohosearch/shops.json'; 57 //return 'http://101.200.31.165/yohosearch/shops.json';
58 - return 'http://192.168.10.64:8080/yohosearch/shops.json'; 58 + return 'http://182.92.99.119:8080/yohosearch/shops.json';
59 } 59 }
60 // return 'http://101.200.31.165/yohosearch/search.json'; 60 // return 'http://101.200.31.165/yohosearch/search.json';
61 - return 'http://192.168.10.64:8080/yohosearch/search-once.json'; 61 + return 'http://182.92.99.119:8080/yohosearch/search-once.json';
62 } 62 }
63 } 63 }
64 64
@@ -77,23 +77,31 @@ class HelperSearch @@ -77,23 +77,31 @@ class HelperSearch
77 $result['hasNextPage'] = self::next($data['product']['page_total']); 77 $result['hasNextPage'] = self::next($data['product']['page_total']);
78 } 78 }
79 //全部折扣 79 //全部折扣
80 - if ($data['discount']['discount'] && !empty($data['discount']['discount'])) { 80 + if (isset($data['discount']['discount']) && !empty($data['discount']['discount'])) {
81 $result['leftContent'][]['allDiscount'] = self::getDiscount($data['discount']['discount']); 81 $result['leftContent'][]['allDiscount'] = self::getDiscount($data['discount']['discount']);
82 } 82 }
83 //分类条件(搜索页面) 83 //分类条件(搜索页面)
84 - if (isset($data['sort']) && isset($options['controller']) && $options['controller'] != 'Search') {  
85 - $result['filters']['sort'] = self::searchSort($data['sort']['sort']); 84 + if (isset($data['sort']['sort'])) {
  85 + //分类条件(搜索页面)
  86 + if (isset($options['controller']) && $options['controller'] != 'Search') {
  87 + $result['filters']['sort'] = self::searchSort($data['sort']['sort']);
  88 + }else{
  89 + //左侧分类分类
  90 + $result['leftContent'][]['allSort'] = self::groupSort($data['sort']['sort']);
  91 + }
86 } 92 }
87 - //左侧分类分类  
88 - $result['leftContent'][]['allSort'] = isset($data['sort']) ? self::groupSort($data['sort']['sort']) : array();  
89 //一周新品上架 93 //一周新品上架
90 - $result['leftContent'][]['newSales'] = isset($data['recent']) ? self::recentShelve($data['recent']['recent']) : array(); 94 + if (isset($data['recent']['recent']) && !empty($data['recent']['recent'])) {
  95 + $result['leftContent'][]['newSales'] = self::recentShelve($data['recent']['recent']);
  96 + }
91 //品牌banner 97 //品牌banner
92 $result['brandBanner'] = isset($data['brand']) ? self::getBannerFormat($data['brand'], $options['brandBanner']) : array(); 98 $result['brandBanner'] = isset($data['brand']) ? self::getBannerFormat($data['brand'], $options['brandBanner']) : array();
93 //总记录数 99 //总记录数
94 $result['totalCount'] = $data['product']['total']; 100 $result['totalCount'] = $data['product']['total'];
95 //品牌店铺信息 101 //品牌店铺信息
96 - $result['shopEntry'] = isset($data['shop']) && !empty($data['shop']) ? self::shop($data['shop'], $data['sort']['sort']) : array(); 102 + if (isset($data['shop']) && !empty($data['shop'])) {
  103 + $result['shopEntry'] = self::shop($data['shop'], $data['sort']['sort']);
  104 + }
97 //分页 105 //分页
98 $result['pager'] = self::pager($result['totalCount'],$options['viewNum']-1); 106 $result['pager'] = self::pager($result['totalCount'],$options['viewNum']-1);
99 //浏览记录 107 //浏览记录
@@ -2,10 +2,11 @@ @@ -2,10 +2,11 @@
2 namespace Product; 2 namespace Product;
3 3
4 use Api\Yohobuy; 4 use Api\Yohobuy;
5 -use Plugin\Helpers;  
6 -use Plugin\HelperSearch; 5 +use WebPlugin\Helpers;
  6 +use WebPlugin\HelperSearch;
7 use \LibModels\Web\Product\SearchData; 7 use \LibModels\Web\Product\SearchData;
8 use Configs\CacheConfig; 8 use Configs\CacheConfig;
  9 +use WebPlugin\Cache;
9 10
10 /** 11 /**
11 * sale首页模板数据模型 12 * sale首页模板数据模型
@@ -166,17 +167,17 @@ class SearchModel @@ -166,17 +167,17 @@ class SearchModel
166 { 167 {
167 $urlList = array(); 168 $urlList = array();
168 $searchCondition = self::searchCondition($customCondition, $customOptions); 169 $searchCondition = self::searchCondition($customCondition, $customOptions);
169 - if (USE_CACHE) {  
170 - $key = CacheConfig::KEY_WEB_PRODUCT_SEARCH_DATA;  
171 - if (!empty($condition)) {  
172 - $key .= http_build_query($searchCondition['condition'], null, '&');  
173 - }  
174 - // 先尝试获取一级缓存(master), 有数据则直接返回.  
175 - $result = Cache::get($key, 'master');  
176 - if (!empty($result)) {  
177 - return $result;  
178 - }  
179 - } 170 +// if (USE_CACHE) {
  171 +// $key = CacheConfig::KEY_WEB_PRODUCT_SEARCH_DATA;
  172 +// if (!empty($condition)) {
  173 +// $key .= http_build_query($searchCondition['condition'], null, '&');
  174 +// }
  175 +// // 先尝试获取一级缓存(master), 有数据则直接返回.
  176 +// $result = Cache::get($key, 'master');
  177 +// if (!empty($result)) {
  178 +// return $result;
  179 +// }
  180 +// }
180 // 组合搜索商品url 181 // 组合搜索商品url
181 $urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']); 182 $urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']);
182 // 组合搜索分类url 183 // 组合搜索分类url
@@ -190,16 +191,16 @@ class SearchModel @@ -190,16 +191,16 @@ class SearchModel
190 // 组织模板数据 191 // 组织模板数据
191 $result = HelperSearch::getList($data, $searchCondition['options']); 192 $result = HelperSearch::getList($data, $searchCondition['options']);
192 193
193 - if (USE_CACHE) {  
194 - // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.  
195 - if (empty($result)) {  
196 - $result = Cache::get($key, 'slave');  
197 - }  
198 - // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存  
199 - else {  
200 - Cache::set($key, $result, 1800); // 缓存30分钟  
201 - }  
202 - } 194 +// if (USE_CACHE) {
  195 +// // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  196 +// if (empty($result)) {
  197 +// $result = Cache::get($key, 'slave');
  198 +// }
  199 +// // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
  200 +// else {
  201 +// Cache::set($key, $result, 1800); // 缓存30分钟
  202 +// }
  203 +// }
203 return $result; 204 return $result;
204 } 205 }
205 /** 206 /**