Showing
1 changed file
with
6 additions
and
66 deletions
1 | <?php | 1 | <?php |
2 | use Action\WebAction; | 2 | use Action\WebAction; |
3 | use LibModels\Web\Product\BrandData; | 3 | use LibModels\Web\Product\BrandData; |
4 | +use Product\SearchModel; | ||
5 | + | ||
4 | class IndexController extends WebAction | 6 | class IndexController extends WebAction |
5 | { | 7 | { |
6 | 8 | ||
@@ -24,77 +26,15 @@ class IndexController extends WebAction | @@ -24,77 +26,15 @@ class IndexController extends WebAction | ||
24 | $this->go(SITE_MAIN); | 26 | $this->go(SITE_MAIN); |
25 | } | 27 | } |
26 | 28 | ||
27 | - /* 过滤请求参数 */ | ||
28 | - $condition = array(); | ||
29 | - $condition = filter_input_array(INPUT_GET, array( | ||
30 | - //'query' => FILTER_SANITIZE_STRING, | ||
31 | - 'sort' => FILTER_VALIDATE_INT, | ||
32 | - 'msort' => FILTER_VALIDATE_INT, | ||
33 | - 'misort' => FILTER_VALIDATE_INT, | ||
34 | - 'color' => FILTER_VALIDATE_INT, | ||
35 | - 'size' => FILTER_VALIDATE_INT, | ||
36 | - 'style' => FILTER_DEFAULT, | ||
37 | - 'price' => FILTER_DEFAULT, | ||
38 | - 'gender' => FILTER_DEFAULT, | ||
39 | - 'p_d' => FILTER_DEFAULT, | ||
40 | - 'shelve_time' => FILTER_DEFAULT, | ||
41 | - 'isNew' => FILTER_DEFAULT, | ||
42 | - 'specialoffer' => FILTER_DEFAULT, | ||
43 | - 'limited' => FILTER_DEFAULT, | ||
44 | - 'order' => FILTER_DEFAULT, | ||
45 | - 'viewNum' => FILTER_VALIDATE_INT, | ||
46 | - 'rowNum' => FILTER_VALIDATE_INT, | ||
47 | - 'page' => FILTER_VALIDATE_INT,), false); | ||
48 | - | ||
49 | - //字符转码 | ||
50 | - if (!empty($condition)) { | ||
51 | - foreach ($condition as &$value) { | ||
52 | - $value = rawurldecode($value); | ||
53 | - } | ||
54 | - } | ||
55 | //传品牌ID参数 | 29 | //传品牌ID参数 |
30 | + $condition = array(); | ||
56 | $condition['brand'] = $brandId; | 31 | $condition['brand'] = $brandId; |
57 | 32 | ||
58 | - //获取性别数据 | ||
59 | - $gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : (!isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender']=='2,3' ? 2 : 1)); | ||
60 | - $condition['gender'] = $gender; | 33 | + /* 过滤请求参数 */ |
34 | + SearchModel::SearchCondition($condition); | ||
61 | 35 | ||
62 | - //每页显示商品数 | ||
63 | - if (!isset($condition['viewNum']) || empty($condition['viewNum'])) { | ||
64 | - $condition['viewNum'] =60; | ||
65 | - } | ||
66 | - $view_num_arr = array(60, 100, 200); | ||
67 | - if (!in_array($condition['viewNum'], $view_num_arr)) { | ||
68 | - $condition['viewNum'] = 60; | ||
69 | - } | ||
70 | - //每行显示的商品数量 | ||
71 | - if (!isset($condition['rowNum']) || empty($condition['rowNum'])) { | ||
72 | - $condition['rowNum'] =5; | ||
73 | - } | ||
74 | - if ($condition['rowNum'] == 6) { | ||
75 | - $imgSize = array(195, 260); | ||
76 | - $minImgSize = array(50, 67); | ||
77 | - } else { | ||
78 | - $condition['rowNum'] = 5; | ||
79 | - $imgSize = array(235, 314); | ||
80 | - $minImgSize = array(60, 80); | ||
81 | - } | ||
82 | - //搜索词 | ||
83 | - //$query = $this->get('query'); | ||
84 | - $condition['needFilter'] = 1; | ||
85 | - $options = array( | ||
86 | - 'imgSize' => $imgSize, | ||
87 | - 'minImgSize' => $minImgSize, | ||
88 | - 'gender' => $gender, | ||
89 | - 'needPd' => 'Y', | ||
90 | - 'rowNum' => $condition['rowNum'], | ||
91 | - 'viewNum' => $condition['viewNum'], | ||
92 | - ); | ||
93 | 36 | ||
94 | - $params = $condition + $_GET; | ||
95 | - $params = array_filter($params); | ||
96 | - //每页记录数减1,下一页占位 | ||
97 | - $params['viewNum'] = $params['viewNum'] - 1; | 37 | + |
98 | $data = Product\BrandsModel::getBrandSearchData($params,$options,$domain,$uid,$brandId,$node); | 38 | $data = Product\BrandsModel::getBrandSearchData($params,$options,$domain,$uid,$brandId,$node); |
99 | $cate = array('boys','girls','kids','lifestyle'); | 39 | $cate = array('boys','girls','kids','lifestyle'); |
100 | $this->setWebNavHeader($cate[$gender-1]); | 40 | $this->setWebNavHeader($cate[$gender-1]); |
-
Please register or login to post a comment