Showing
6 changed files
with
32 additions
and
18 deletions
@@ -274,7 +274,7 @@ if ($brandItem.length > 0) { | @@ -274,7 +274,7 @@ if ($brandItem.length > 0) { | ||
274 | function removeHistory() { | 274 | function removeHistory() { |
275 | $.ajax({ | 275 | $.ajax({ |
276 | type: 'GET', | 276 | type: 'GET', |
277 | - url: '/category/brand/delBrandHistory', | 277 | + url: '/brands/delBrandHistory', |
278 | data: '', | 278 | data: '', |
279 | success: function(data) { | 279 | success: function(data) { |
280 | }, | 280 | }, |
@@ -18,8 +18,8 @@ function getRanToken() { | @@ -18,8 +18,8 @@ function getRanToken() { | ||
18 | function addHistory(brandName, brandId, brandDomain) { | 18 | function addHistory(brandName, brandId, brandDomain) { |
19 | $.ajax({ | 19 | $.ajax({ |
20 | type: 'GET', | 20 | type: 'GET', |
21 | - url: '/category/brand/addBrandSearch', | ||
22 | - data: 'brandName=' + brandName + 'brandId=' + brandId + 'brandDomain=' + brandDomain, | 21 | + url: '/brands/addBrandSearch', |
22 | + data: 'brandName=' + brandName + '&brandId=' + brandId + '&brandDomain=' + brandDomain, | ||
23 | success: function(data) { | 23 | success: function(data) { |
24 | }, | 24 | }, |
25 | error: function() { | 25 | error: function() { |
@@ -16,10 +16,10 @@ | @@ -16,10 +16,10 @@ | ||
16 | 16 | ||
17 | <div class="search-brand-page"> | 17 | <div class="search-brand-page"> |
18 | <div class="search-items"> | 18 | <div class="search-items"> |
19 | - {{#if historySearch}} | ||
20 | - <div class="history-search net-search hide"> | 19 | + {{#if history}} |
20 | + <div class="history-search net-search"> | ||
21 | <h3><span class="iconfont"></span>最近搜索 | 21 | <h3><span class="iconfont"></span>最近搜索 |
22 | - <button id="clear-history" class="clear-icon iconfont hide"></button> | 22 | + <button id="clear-history" class="clear-icon iconfont"></button> |
23 | </h3> | 23 | </h3> |
24 | <ul class="history clearfix"> | 24 | <ul class="history clearfix"> |
25 | {{# history}} | 25 | {{# history}} |
@@ -163,7 +163,7 @@ class BrandModel | @@ -163,7 +163,7 @@ class BrandModel | ||
163 | $list['isNew'] = ($row['is_show_new'] === 'Y') ? true : false; | 163 | $list['isNew'] = ($row['is_show_new'] === 'Y') ? true : false; |
164 | $list['url'] = Helpers::url('', null, $row['brand_domain']); | 164 | $list['url'] = Helpers::url('', null, $row['brand_domain']); |
165 | $list['brandId'] = $row['id']; | 165 | $list['brandId'] = $row['id']; |
166 | - $list['brandDomain'] = Helpers::url('', null, $row['brand_domain']); | 166 | + $list['brandDomain'] = $row['brand_domain']; |
167 | $build[] = $list; | 167 | $build[] = $list; |
168 | } | 168 | } |
169 | $result[$char] = $build; | 169 | $result[$char] = $build; |
@@ -189,14 +189,14 @@ class BrandModel | @@ -189,14 +189,14 @@ class BrandModel | ||
189 | break; | 189 | break; |
190 | } | 190 | } |
191 | foreach ($list['data'] as $key => $val) { | 191 | foreach ($list['data'] as $key => $val) { |
192 | - $result[] = array( | ||
193 | - 'url' => isset($val['brandDomain']) ? Helpers::url('', '', $val['brandDomain']) : 'test', | ||
194 | - 'id' => $val['id'], | ||
195 | - 'name' => $val['brandName'] | 192 | + $result[$val['brandDomain']] = array( |
193 | + 'url' => isset($val['brandDomain']) ? Helpers::url('', '', $val['brandDomain']) : '', | ||
194 | + 'id' => $val['brandId'], | ||
195 | + 'name' => $val['searchTerms'] | ||
196 | ); | 196 | ); |
197 | } | 197 | } |
198 | } while(false); | 198 | } while(false); |
199 | - | 199 | + $result = array_values($result); |
200 | return $result; | 200 | return $result; |
201 | } | 201 | } |
202 | 202 | ||
@@ -215,9 +215,9 @@ class BrandModel | @@ -215,9 +215,9 @@ class BrandModel | ||
215 | } | 215 | } |
216 | foreach ($hot['data'] as $key => $val) { | 216 | foreach ($hot['data'] as $key => $val) { |
217 | $result[] = array( | 217 | $result[] = array( |
218 | - 'url' => isset($val['brandDomain']) ? Helpers::url('', '', $val['brandDomain']) : 'test', | ||
219 | - 'id' => $val['id'], | ||
220 | - 'name' => $val['brandName'] | 218 | + 'url' => isset($val['brandDomain']) ? Helpers::url('', '', $val['brandDomain']) : '', |
219 | + 'id' => isset($val['brandId']) ? $val['brandId'] : '', | ||
220 | + 'name' => isset($val['brandName']) ? $val['brandName'] : '' | ||
221 | ); | 221 | ); |
222 | } | 222 | } |
223 | } while(false); | 223 | } while(false); |
@@ -66,7 +66,7 @@ class BrandController extends AbstractAction | @@ -66,7 +66,7 @@ class BrandController extends AbstractAction | ||
66 | $data = BrandModel::getBrandForSearch($channel); | 66 | $data = BrandModel::getBrandForSearch($channel); |
67 | //品牌搜索记录 | 67 | //品牌搜索记录 |
68 | if (!empty($uid)) { | 68 | if (!empty($uid)) { |
69 | - $data['historySearch']['history'] = BrandModel::branchSearchHistory($uid); | 69 | + $data['history'] = BrandModel::branchSearchHistory($uid); |
70 | } | 70 | } |
71 | //热搜品牌 | 71 | //热搜品牌 |
72 | $data['hot'] = BrandModel::branchSearchHot(); | 72 | $data['hot'] = BrandModel::branchSearchHot(); |
@@ -82,11 +82,11 @@ class BrandController extends AbstractAction | @@ -82,11 +82,11 @@ class BrandController extends AbstractAction | ||
82 | { | 82 | { |
83 | $result = array(); | 83 | $result = array(); |
84 | $uid = $this->getUid(); | 84 | $uid = $this->getUid(); |
85 | - $brandName = $this->get('brandNme'); | 85 | + $brandName = $this->get('brandName'); |
86 | $brandDomain = $this->get('brandDomain'); | 86 | $brandDomain = $this->get('brandDomain'); |
87 | $brandId = $this->get('brandId'); | 87 | $brandId = $this->get('brandId'); |
88 | do { | 88 | do { |
89 | - if (!$this->isAjax() || empty($brandId) || empty($uid) || empty($brandDomain) || empty($brandName)) { | 89 | + if (empty($brandId) || empty($uid) || empty($brandDomain) || empty($brandName)) { |
90 | break; | 90 | break; |
91 | } | 91 | } |
92 | $records = time().'_'.$brandName.'_'.$brandDomain.'_'.$brandId; | 92 | $records = time().'_'.$brandName.'_'.$brandDomain.'_'.$brandId; |
@@ -82,6 +82,20 @@ routes.brandsearch.route.module = Category | @@ -82,6 +82,20 @@ routes.brandsearch.route.module = Category | ||
82 | routes.brandsearch.route.controller = Brand | 82 | routes.brandsearch.route.controller = Brand |
83 | routes.brandsearch.route.action = Search | 83 | routes.brandsearch.route.action = Search |
84 | 84 | ||
85 | +; 添加品牌搜索 | ||
86 | +routes.addbrandsearch.type = "rewrite" | ||
87 | +routes.addbrandsearch.match = "/brands/addBrandSearch" | ||
88 | +routes.addbrandsearch.route.module = Category | ||
89 | +routes.addbrandsearch.route.controller = Brand | ||
90 | +routes.addbrandsearch.route.action = addBrandSearch | ||
91 | + | ||
92 | +; 清空 | ||
93 | +routes.delbrandsearch.type = "rewrite" | ||
94 | +routes.delbrandsearch.match = "/brands/delBrandHistory" | ||
95 | +routes.delbrandsearch.route.module = Category | ||
96 | +routes.delbrandsearch.route.controller = Brand | ||
97 | +routes.delbrandsearch.route.action = delBrandHistory | ||
98 | + | ||
85 | ; 新品到着(NEW) | 99 | ; 新品到着(NEW) |
86 | routes.productnew.type = "rewrite" | 100 | routes.productnew.type = "rewrite" |
87 | routes.productnew.match = "/product/new$" | 101 | routes.productnew.match = "/product/new$" |
-
Please register or login to post a comment