|
@@ -35,13 +35,14 @@ class SearchController extends AbstractAction |
|
@@ -35,13 +35,14 @@ class SearchController extends AbstractAction |
35
|
// 过滤请求参数
|
35
|
// 过滤请求参数
|
36
|
$condition = filter_input_array(INPUT_GET, array(
|
36
|
$condition = filter_input_array(INPUT_GET, array(
|
37
|
'query' => FILTER_DEFAULT,
|
37
|
'query' => FILTER_DEFAULT,
|
38
|
- 'brand' => FILTER_VALIDATE_INT,
|
38
|
+ 'brand' => FILTER_DEFAULT,
|
39
|
'sort' => FILTER_DEFAULT,
|
39
|
'sort' => FILTER_DEFAULT,
|
40
|
'msort' => FILTER_DEFAULT,
|
40
|
'msort' => FILTER_DEFAULT,
|
41
|
'misort' => FILTER_DEFAULT,
|
41
|
'misort' => FILTER_DEFAULT,
|
42
|
- 'color' => FILTER_VALIDATE_INT,
|
|
|
43
|
- 'size' => FILTER_VALIDATE_INT,
|
|
|
44
|
- 'price' => FILTER_VALIDATE_INT,
|
42
|
+ 'color' => FILTER_DEFAULT,
|
|
|
43
|
+ 'size' => FILTER_DEFAULT,
|
|
|
44
|
+ 'style' => FILTER_DEFAULT,
|
|
|
45
|
+ 'price' => FILTER_DEFAULT,
|
45
|
'discount' => FILTER_DEFAULT,
|
46
|
'discount' => FILTER_DEFAULT,
|
46
|
'gender' => FILTER_DEFAULT,
|
47
|
'gender' => FILTER_DEFAULT,
|
47
|
'p_d' => FILTER_DEFAULT,), false);
|
48
|
'p_d' => FILTER_DEFAULT,), false);
|
|
@@ -49,7 +50,11 @@ class SearchController extends AbstractAction |
|
@@ -49,7 +50,11 @@ class SearchController extends AbstractAction |
49
|
$query = empty($condition['query']) ? null : strtolower(trim($condition['query']));
|
50
|
$query = empty($condition['query']) ? null : strtolower(trim($condition['query']));
|
50
|
if (isset($condition['discount'])) {
|
51
|
if (isset($condition['discount'])) {
|
51
|
$condition['p_d'] = rawurldecode($condition['discount']);
|
52
|
$condition['p_d'] = rawurldecode($condition['discount']);
|
52
|
- unset($condition['discount']);
|
53
|
+ // unset($condition['discount']); 为了兼容js中传参的discount
|
|
|
54
|
+ }
|
|
|
55
|
+ // 为了兼容现在运营在用的p_d
|
|
|
56
|
+ if (isset($condition['p_d'])) {
|
|
|
57
|
+ $condition['discount'] = rawurldecode($condition['p_d']);
|
53
|
}
|
58
|
}
|
54
|
if (isset($condition['query'])) {
|
59
|
if (isset($condition['query'])) {
|
55
|
$condition['query'] = rawurlencode($condition['query']);
|
60
|
$condition['query'] = rawurlencode($condition['query']);
|
|
@@ -200,13 +205,14 @@ class SearchController extends AbstractAction |
|
@@ -200,13 +205,14 @@ class SearchController extends AbstractAction |
200
|
/* 过滤请求参数 */
|
205
|
/* 过滤请求参数 */
|
201
|
$condition = filter_input_array(INPUT_GET, array(
|
206
|
$condition = filter_input_array(INPUT_GET, array(
|
202
|
'query' => FILTER_DEFAULT,
|
207
|
'query' => FILTER_DEFAULT,
|
203
|
- 'brand' => FILTER_VALIDATE_INT,
|
208
|
+ 'brand' => FILTER_DEFAULT,
|
204
|
'sort' => FILTER_DEFAULT,
|
209
|
'sort' => FILTER_DEFAULT,
|
205
|
'msort' => FILTER_DEFAULT,
|
210
|
'msort' => FILTER_DEFAULT,
|
206
|
'misort' => FILTER_DEFAULT,
|
211
|
'misort' => FILTER_DEFAULT,
|
207
|
- 'color' => FILTER_VALIDATE_INT,
|
|
|
208
|
- 'size' => FILTER_VALIDATE_INT,
|
|
|
209
|
- 'price' => FILTER_VALIDATE_INT,
|
212
|
+ 'color' => FILTER_DEFAULT,
|
|
|
213
|
+ 'size' => FILTER_DEFAULT,
|
|
|
214
|
+ 'style' => FILTER_DEFAULT,
|
|
|
215
|
+ 'price' => FILTER_DEFAULT,
|
210
|
'discount' => FILTER_DEFAULT,
|
216
|
'discount' => FILTER_DEFAULT,
|
211
|
'gender' => FILTER_DEFAULT,
|
217
|
'gender' => FILTER_DEFAULT,
|
212
|
'p_d' => FILTER_DEFAULT,
|
218
|
'p_d' => FILTER_DEFAULT,
|
|
@@ -215,12 +221,22 @@ class SearchController extends AbstractAction |
|
@@ -215,12 +221,22 @@ class SearchController extends AbstractAction |
215
|
if (isset($condition['sort'])) {
|
221
|
if (isset($condition['sort'])) {
|
216
|
$condition['sort'] = rawurldecode($condition['sort']);
|
222
|
$condition['sort'] = rawurldecode($condition['sort']);
|
217
|
}
|
223
|
}
|
|
|
224
|
+ // 转义分类
|
218
|
if (isset($condition['msort'])) {
|
225
|
if (isset($condition['msort'])) {
|
219
|
$condition['msort'] = rawurldecode($condition['msort']);
|
226
|
$condition['msort'] = rawurldecode($condition['msort']);
|
220
|
}
|
227
|
}
|
|
|
228
|
+ // 转义分类
|
221
|
if (isset($condition['misort'])) {
|
229
|
if (isset($condition['misort'])) {
|
222
|
$condition['misort'] = rawurldecode($condition['misort']);
|
230
|
$condition['misort'] = rawurldecode($condition['misort']);
|
223
|
}
|
231
|
}
|
|
|
232
|
+ // 转义价格
|
|
|
233
|
+ if (isset($condition['price'])) {
|
|
|
234
|
+ $condition['price'] = rawurldecode($condition['price']);
|
|
|
235
|
+ }
|
|
|
236
|
+ // 转义风格
|
|
|
237
|
+ if (isset($condition['style'])) {
|
|
|
238
|
+ $condition['style'] = rawurldecode($condition['style']);
|
|
|
239
|
+ }
|
224
|
// 转换折扣
|
240
|
// 转换折扣
|
225
|
if (isset($condition['discount'])) {
|
241
|
if (isset($condition['discount'])) {
|
226
|
$condition['p_d'] = rawurldecode($condition['discount']);
|
242
|
$condition['p_d'] = rawurldecode($condition['discount']);
|
|
@@ -259,7 +275,6 @@ class SearchController extends AbstractAction |
|
@@ -259,7 +275,6 @@ class SearchController extends AbstractAction |
259
|
// $data = Product\ListModel::getClassData($condition);
|
275
|
// $data = Product\ListModel::getClassData($condition);
|
260
|
|
276
|
|
261
|
$data = Product\SearchModel::getSearchData($condition);
|
277
|
$data = Product\SearchModel::getSearchData($condition);
|
262
|
-
|
|
|
263
|
} while (false);
|
278
|
} while (false);
|
264
|
|
279
|
|
265
|
if (empty($data['new'])) {
|
280
|
if (empty($data['new'])) {
|
|
@@ -281,13 +296,14 @@ class SearchController extends AbstractAction |
|
@@ -281,13 +296,14 @@ class SearchController extends AbstractAction |
281
|
// 过滤请求参数
|
296
|
// 过滤请求参数
|
282
|
$condition = filter_input_array(INPUT_GET, array(
|
297
|
$condition = filter_input_array(INPUT_GET, array(
|
283
|
'query' => FILTER_DEFAULT,
|
298
|
'query' => FILTER_DEFAULT,
|
284
|
- 'brand' => FILTER_VALIDATE_INT,
|
299
|
+ 'brand' => FILTER_DEFAULT,
|
285
|
'sort' => FILTER_DEFAULT,
|
300
|
'sort' => FILTER_DEFAULT,
|
286
|
- 'msort' => FILTER_VALIDATE_INT,
|
|
|
287
|
- 'misort' => FILTER_VALIDATE_INT,
|
|
|
288
|
- 'color' => FILTER_VALIDATE_INT,
|
|
|
289
|
- 'size' => FILTER_VALIDATE_INT,
|
|
|
290
|
- 'price' => FILTER_VALIDATE_INT,
|
301
|
+ 'msort' => FILTER_DEFAULT,
|
|
|
302
|
+ 'misort' => FILTER_DEFAULT,
|
|
|
303
|
+ 'color' => FILTER_DEFAULT,
|
|
|
304
|
+ 'size' => FILTER_DEFAULT,
|
|
|
305
|
+ 'style' => FILTER_DEFAULT,
|
|
|
306
|
+ 'price' => FILTER_DEFAULT,
|
291
|
'discount' => FILTER_DEFAULT,
|
307
|
'discount' => FILTER_DEFAULT,
|
292
|
'gender' => FILTER_DEFAULT,
|
308
|
'gender' => FILTER_DEFAULT,
|
293
|
'p_d' => FILTER_DEFAULT,), false);
|
309
|
'p_d' => FILTER_DEFAULT,), false);
|
|
@@ -305,6 +321,14 @@ class SearchController extends AbstractAction |
|
@@ -305,6 +321,14 @@ class SearchController extends AbstractAction |
305
|
if (isset($condition['gender'])) {
|
321
|
if (isset($condition['gender'])) {
|
306
|
$condition['gender'] = rawurldecode($condition['gender']);
|
322
|
$condition['gender'] = rawurldecode($condition['gender']);
|
307
|
}
|
323
|
}
|
|
|
324
|
+ // 转义价格
|
|
|
325
|
+ if (isset($condition['price'])) {
|
|
|
326
|
+ $condition['price'] = rawurldecode($condition['price']);
|
|
|
327
|
+ }
|
|
|
328
|
+ // 转义风格
|
|
|
329
|
+ if (isset($condition['style'])) {
|
|
|
330
|
+ $condition['style'] = rawurldecode($condition['style']);
|
|
|
331
|
+ }
|
308
|
|
332
|
|
309
|
// 区别各种列表页面的筛选数据
|
333
|
// 区别各种列表页面的筛选数据
|
310
|
$data = Product\SearchModel::getFilterData($condition);
|
334
|
$data = Product\SearchModel::getFilterData($condition);
|