merge release code to fixes bugs
Showing
3 changed files
with
132 additions
and
30 deletions
@@ -65,8 +65,8 @@ class ListData | @@ -65,8 +65,8 @@ class ListData | ||
65 | $param['author_id'] = $authorId; | 65 | $param['author_id'] = $authorId; |
66 | } | 66 | } |
67 | $param['client_secret'] = Sign::getSign($param); | 67 | $param['client_secret'] = Sign::getSign($param); |
68 | - | ||
69 | - return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_ARTICLELIST, $param); | 68 | + |
69 | + return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_ARTICLELIST, $param, 300); // 缓存5分钟 | ||
70 | } | 70 | } |
71 | 71 | ||
72 | /** | 72 | /** |
@@ -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); |
@@ -25,17 +25,58 @@ class IndexController extends AbstractAction | @@ -25,17 +25,58 @@ class IndexController extends AbstractAction | ||
25 | { | 25 | { |
26 | // 过滤请求参数 | 26 | // 过滤请求参数 |
27 | $condition = filter_input_array(INPUT_GET, array( | 27 | $condition = filter_input_array(INPUT_GET, array( |
28 | - 'brand' => FILTER_VALIDATE_INT, | 28 | + 'brand' => FILTER_DEFAULT, |
29 | 'sort' => FILTER_DEFAULT, | 29 | 'sort' => FILTER_DEFAULT, |
30 | 'msort' => FILTER_DEFAULT, | 30 | 'msort' => FILTER_DEFAULT, |
31 | 'misort' => FILTER_DEFAULT, | 31 | 'misort' => FILTER_DEFAULT, |
32 | - 'color' => FILTER_VALIDATE_INT, | ||
33 | - 'size' => FILTER_VALIDATE_INT, | ||
34 | - 'price' => FILTER_VALIDATE_INT, | ||
35 | - 'discount' => FILTER_VALIDATE_INT, | 32 | + 'color' => FILTER_DEFAULT, |
33 | + 'size' => FILTER_DEFAULT, | ||
34 | + 'style' => FILTER_DEFAULT, | ||
35 | + 'price' => FILTER_DEFAULT, | ||
36 | + 'discount' => FILTER_DEFAULT, | ||
36 | 'gender' => FILTER_DEFAULT, | 37 | 'gender' => FILTER_DEFAULT, |
37 | 'p_d' => FILTER_DEFAULT,), false); | 38 | 'p_d' => FILTER_DEFAULT,), false); |
38 | 39 | ||
40 | + // 转义品牌 | ||
41 | + if (isset($condition['brand'])) { | ||
42 | + $condition['brand'] = rawurldecode($condition['brand']); | ||
43 | + } | ||
44 | + // 转义分类 | ||
45 | + if (isset($condition['sort'])) { | ||
46 | + $condition['sort'] = rawurldecode($condition['sort']); | ||
47 | + } | ||
48 | + // 转义一级分类 | ||
49 | + if (isset($condition['msort'])) { | ||
50 | + $condition['msort'] = rawurldecode($condition['msort']); | ||
51 | + } | ||
52 | + // 转义二级分类 | ||
53 | + if (isset($condition['misort'])) { | ||
54 | + $condition['misort'] = rawurldecode($condition['misort']); | ||
55 | + } | ||
56 | + // 转义颜色 | ||
57 | + if (isset($condition['color'])) { | ||
58 | + $condition['color'] = rawurldecode($condition['color']); | ||
59 | + } | ||
60 | + // 转义尺码 | ||
61 | + if (isset($condition['size'])) { | ||
62 | + $condition['size'] = rawurldecode($condition['size']); | ||
63 | + } | ||
64 | + // 转义风格 | ||
65 | + if (isset($condition['style'])) { | ||
66 | + $condition['style'] = rawurldecode($condition['style']); | ||
67 | + } | ||
68 | + // 转义价格 | ||
69 | + if (isset($condition['price'])) { | ||
70 | + $condition['price'] = rawurldecode($condition['price']); | ||
71 | + } | ||
72 | + // 转换折扣 | ||
73 | + if (isset($condition['discount'])) { | ||
74 | + $condition['p_d'] = rawurldecode($condition['discount']); | ||
75 | + } | ||
76 | + // 为了兼容现在运营在用的p_d | ||
77 | + if (isset($condition['p_d'])) { | ||
78 | + $condition['discount'] = rawurldecode($condition['p_d']); | ||
79 | + } | ||
39 | // 性别参数,不传则从COOKIE获取 | 80 | // 性别参数,不传则从COOKIE获取 |
40 | if (!isset($condition['gender'])) { | 81 | if (!isset($condition['gender'])) { |
41 | $condition['gender'] = Helpers::getGenderByCookie(); | 82 | $condition['gender'] = Helpers::getGenderByCookie(); |
@@ -94,7 +135,7 @@ class IndexController extends AbstractAction | @@ -94,7 +135,7 @@ class IndexController extends AbstractAction | ||
94 | if ($brandLogo && isset($brandLogo['id'])) { | 135 | if ($brandLogo && isset($brandLogo['id'])) { |
95 | $brandId = $brandLogo['id']; | 136 | $brandId = $brandLogo['id']; |
96 | } | 137 | } |
97 | - | 138 | + |
98 | /* 通过品牌域名找到对应的品牌ID */ | 139 | /* 通过品牌域名找到对应的品牌ID */ |
99 | // $domainList = Product\ListModel::getAllBrandDomains(); | 140 | // $domainList = Product\ListModel::getAllBrandDomains(); |
100 | // $brandIds = array_keys($domainList, $domain); | 141 | // $brandIds = array_keys($domainList, $domain); |
@@ -112,16 +153,53 @@ class IndexController extends AbstractAction | @@ -112,16 +153,53 @@ class IndexController extends AbstractAction | ||
112 | /* 过滤请求参数 */ | 153 | /* 过滤请求参数 */ |
113 | $condition = filter_input_array(INPUT_GET, array( | 154 | $condition = filter_input_array(INPUT_GET, array( |
114 | 'sort' => FILTER_DEFAULT, | 155 | 'sort' => FILTER_DEFAULT, |
115 | - 'msort' => FILTER_VALIDATE_INT, | ||
116 | - 'misort' => FILTER_VALIDATE_INT, | ||
117 | - 'color' => FILTER_VALIDATE_INT, | ||
118 | - 'size' => FILTER_VALIDATE_INT, | ||
119 | - 'price' => FILTER_VALIDATE_INT, | ||
120 | - 'discount' => FILTER_VALIDATE_INT, | 156 | + 'msort' => FILTER_DEFAULT, |
157 | + 'misort' => FILTER_DEFAULT, | ||
158 | + 'color' => FILTER_DEFAULT, | ||
159 | + 'size' => FILTER_DEFAULT, | ||
160 | + 'style' => FILTER_DEFAULT, | ||
161 | + 'price' => FILTER_DEFAULT, | ||
162 | + 'discount' => FILTER_DEFAULT, | ||
121 | 'gender' => FILTER_DEFAULT, | 163 | 'gender' => FILTER_DEFAULT, |
122 | 'p_d' => FILTER_DEFAULT,), false); | 164 | 'p_d' => FILTER_DEFAULT,), false); |
123 | $condition['brand'] = $brandId; | 165 | $condition['brand'] = $brandId; |
124 | 166 | ||
167 | + // 转义分类 | ||
168 | + if (isset($condition['sort'])) { | ||
169 | + $condition['sort'] = rawurldecode($condition['sort']); | ||
170 | + } | ||
171 | + // 转义一级分类 | ||
172 | + if (isset($condition['msort'])) { | ||
173 | + $condition['msort'] = rawurldecode($condition['msort']); | ||
174 | + } | ||
175 | + // 转义二级分类 | ||
176 | + if (isset($condition['misort'])) { | ||
177 | + $condition['misort'] = rawurldecode($condition['misort']); | ||
178 | + } | ||
179 | + // 转义颜色 | ||
180 | + if (isset($condition['color'])) { | ||
181 | + $condition['color'] = rawurldecode($condition['color']); | ||
182 | + } | ||
183 | + // 转义尺码 | ||
184 | + if (isset($condition['size'])) { | ||
185 | + $condition['size'] = rawurldecode($condition['size']); | ||
186 | + } | ||
187 | + // 转义风格 | ||
188 | + if (isset($condition['style'])) { | ||
189 | + $condition['style'] = rawurldecode($condition['style']); | ||
190 | + } | ||
191 | + // 转义价格 | ||
192 | + if (isset($condition['price'])) { | ||
193 | + $condition['price'] = rawurldecode($condition['price']); | ||
194 | + } | ||
195 | + // 转换折扣 | ||
196 | + if (isset($condition['discount'])) { | ||
197 | + $condition['p_d'] = rawurldecode($condition['discount']); | ||
198 | + } | ||
199 | + // 为了兼容现在运营在用的p_d | ||
200 | + if (isset($condition['p_d'])) { | ||
201 | + $condition['discount'] = rawurldecode($condition['p_d']); | ||
202 | + } | ||
125 | if ($brandId === 0) { | 203 | if ($brandId === 0) { |
126 | $condition['query'] = $domain; | 204 | $condition['query'] = $domain; |
127 | } | 205 | } |
-
Please register or login to post a comment