fixes bug to search list page show brand
Showing
3 changed files
with
34 additions
and
10 deletions
@@ -16,6 +16,7 @@ use Api\Sign; | @@ -16,6 +16,7 @@ use Api\Sign; | ||
16 | */ | 16 | */ |
17 | class BrandData | 17 | class BrandData |
18 | { | 18 | { |
19 | + | ||
19 | const URI_BRAND_TOPPOS = 'operations/api/v5/resource/get'; | 20 | const URI_BRAND_TOPPOS = 'operations/api/v5/resource/get'; |
20 | 21 | ||
21 | /** | 22 | /** |
@@ -182,14 +183,20 @@ class BrandData | @@ -182,14 +183,20 @@ class BrandData | ||
182 | * @param integer $channel 表示频道号,1位男生,2为女生 | 183 | * @param integer $channel 表示频道号,1位男生,2为女生 |
183 | * @return array 品类商品数据 | 184 | * @return array 品类商品数据 |
184 | */ | 185 | */ |
185 | - public static function filterBrandData($condition, $order = 's_t_desc', $limit = 60, $page = 1) | 186 | + public static function filterBrandData($condition) |
186 | { | 187 | { |
187 | $param = Yohobuy::param(); | 188 | $param = Yohobuy::param(); |
188 | $param['method'] = 'app.search.brand'; | 189 | $param['method'] = 'app.search.brand'; |
189 | - $param['page'] = $page; | ||
190 | - $param['limit'] = $limit; | ||
191 | - $param['order'] = $order; | ||
192 | $param += $condition; | 190 | $param += $condition; |
191 | + if (!isset($param['order'])) { | ||
192 | + $param['order'] = 's_t_desc'; | ||
193 | + } | ||
194 | + if (!isset($param['limit'])) { | ||
195 | + $param['limit'] = 60; | ||
196 | + } | ||
197 | + if (!isset($param['page'])) { | ||
198 | + $param['page'] = 1; | ||
199 | + } | ||
193 | $param['client_secret'] = Sign::getSign($param); | 200 | $param['client_secret'] = Sign::getSign($param); |
194 | 201 | ||
195 | return Yohobuy::get(Yohobuy::API_URL, $param); | 202 | return Yohobuy::get(Yohobuy::API_URL, $param); |
@@ -92,14 +92,20 @@ class ClassData | @@ -92,14 +92,20 @@ class ClassData | ||
92 | * @param integer $channel 表示频道号,1位男生,2为女生 | 92 | * @param integer $channel 表示频道号,1位男生,2为女生 |
93 | * @return array 品类商品数据 | 93 | * @return array 品类商品数据 |
94 | */ | 94 | */ |
95 | - public static function filterClassData($condition, $order = 's_t_desc', $limit = 60, $page = 1) | 95 | + public static function filterClassData($condition) |
96 | { | 96 | { |
97 | $param = Yohobuy::param(); | 97 | $param = Yohobuy::param(); |
98 | $param['method'] = 'app.search.category'; | 98 | $param['method'] = 'app.search.category'; |
99 | - $param['page'] = $page; | ||
100 | - $param['limit'] = $limit; | ||
101 | - $param['order'] = $order; | ||
102 | $param += $condition; | 99 | $param += $condition; |
100 | + if (!isset($param['order'])) { | ||
101 | + $param['order'] = 's_t_desc'; | ||
102 | + } | ||
103 | + if (!isset($param['limit'])) { | ||
104 | + $param['limit'] = 60; | ||
105 | + } | ||
106 | + if (!isset($param['page'])) { | ||
107 | + $param['page'] = 1; | ||
108 | + } | ||
103 | $param['client_secret'] = Sign::getSign($param); | 109 | $param['client_secret'] = Sign::getSign($param); |
104 | 110 | ||
105 | return Yohobuy::get(Yohobuy::API_URL, $param); | 111 | return Yohobuy::get(Yohobuy::API_URL, $param); |
@@ -171,6 +171,7 @@ class SearchController extends AbstractAction | @@ -171,6 +171,7 @@ class SearchController extends AbstractAction | ||
171 | 171 | ||
172 | $data['goodListPage'] = true; | 172 | $data['goodListPage'] = true; |
173 | $data['goodList'] = $condition; | 173 | $data['goodList'] = $condition; |
174 | + $data['query'] = $query; | ||
174 | 175 | ||
175 | // 查询数据 | 176 | // 查询数据 |
176 | if (!isset($condition['query'])) { | 177 | if (!isset($condition['query'])) { |
@@ -233,9 +234,19 @@ class SearchController extends AbstractAction | @@ -233,9 +234,19 @@ class SearchController extends AbstractAction | ||
233 | } | 234 | } |
234 | 235 | ||
235 | $data = array(); | 236 | $data = array(); |
236 | - // 查询品类数据 | 237 | + // 查询品类或品牌数据 |
237 | if (!isset($condition['query'])) { | 238 | if (!isset($condition['query'])) { |
238 | - $data += Product\ListModel::getClassData($condition, $order, $page); | 239 | + $condition['order'] = $order; |
240 | + $condition['page'] = $page; | ||
241 | + // 搜索品类 | ||
242 | + if (!isset($condition['brand'])) { | ||
243 | + $data += Product\ListModel::getClassData($condition); | ||
244 | + } | ||
245 | + // 搜索品牌 | ||
246 | + else { | ||
247 | + $title = ''; | ||
248 | + $data += Product\ListModel::getBrandData($condition, $title); | ||
249 | + } | ||
239 | if (isset($data['filter'])) { | 250 | if (isset($data['filter'])) { |
240 | unset($data['filter']); | 251 | unset($data['filter']); |
241 | } | 252 | } |
-
Please register or login to post a comment