1
|
<?php
|
1
|
<?php
|
2
|
|
2
|
|
3
|
use Action\AbstractAction;
|
3
|
use Action\AbstractAction;
|
|
|
4
|
+use LibModels\Web\Product\SaleData;
|
4
|
use Plugin\Helpers;
|
5
|
use Plugin\Helpers;
|
5
|
|
6
|
|
6
|
/**
|
7
|
/**
|
|
@@ -228,4 +229,121 @@ class IndexController extends AbstractAction |
|
@@ -228,4 +229,121 @@ class IndexController extends AbstractAction |
228
|
|
229
|
|
229
|
$this->_view->display('index', $data);
|
230
|
$this->_view->display('index', $data);
|
230
|
}
|
231
|
}
|
|
|
232
|
+
|
|
|
233
|
+ /**
|
|
|
234
|
+ * 活动专区
|
|
|
235
|
+ *
|
|
|
236
|
+ * @param int channel 1:男生,2:女生,3:潮童,4:创意生活
|
|
|
237
|
+ */
|
|
|
238
|
+ public function saleAction()
|
|
|
239
|
+ {
|
|
|
240
|
+ // 过滤请求参数
|
|
|
241
|
+ $condition = filter_input_array(INPUT_GET, array(
|
|
|
242
|
+ 'brand' => FILTER_DEFAULT,
|
|
|
243
|
+ 'specialsale_id' => FILTER_DEFAULT,
|
|
|
244
|
+ 'promotion' => FILTER_DEFAULT,
|
|
|
245
|
+ 'sort' => FILTER_DEFAULT,
|
|
|
246
|
+ 'msort' => FILTER_DEFAULT,
|
|
|
247
|
+ 'misort' => FILTER_DEFAULT,
|
|
|
248
|
+ 'color' => FILTER_DEFAULT,
|
|
|
249
|
+ 'size' => FILTER_DEFAULT,
|
|
|
250
|
+ 'style' => FILTER_DEFAULT,
|
|
|
251
|
+ 'price' => FILTER_DEFAULT,
|
|
|
252
|
+ 'discount' => FILTER_DEFAULT,
|
|
|
253
|
+ 'gender' => FILTER_DEFAULT,
|
|
|
254
|
+ 'p_d' => FILTER_DEFAULT,), false);
|
|
|
255
|
+
|
|
|
256
|
+ //专区ID和促销ID都为空时,跳转到主页
|
|
|
257
|
+ if (!isset($condition['specialsale_id']) && isset($condition['promotion'])) {
|
|
|
258
|
+ $this->go(SITE_MAIN);
|
|
|
259
|
+ }
|
|
|
260
|
+
|
|
|
261
|
+ // 转义活动ID
|
|
|
262
|
+ if (isset($condition['specialsale_id'])) {
|
|
|
263
|
+ $condition['specialsale_id'] = rawurldecode($condition['specialsale_id']);
|
|
|
264
|
+ }
|
|
|
265
|
+ if (isset($condition['promotion'])) {
|
|
|
266
|
+ $condition['promotion'] = rawurldecode($condition['promotion']);
|
|
|
267
|
+ }
|
|
|
268
|
+
|
|
|
269
|
+ // 获取促销信息
|
|
|
270
|
+ $special = array();
|
|
|
271
|
+ $specialInfo = SaleData::getSpecial($condition['specialsale_id']);
|
|
|
272
|
+ if(isset($specialInfo['data'])) {
|
|
|
273
|
+ $special = $specialInfo['data'];
|
|
|
274
|
+ }
|
|
|
275
|
+ //传促销id,促销id为空时传专区id
|
|
|
276
|
+ if(!empty($special['ispromotion'])){
|
|
|
277
|
+ $condition['promotion'] = $special['ispromotion'];
|
|
|
278
|
+ }
|
|
|
279
|
+
|
|
|
280
|
+ // 转义品牌
|
|
|
281
|
+ if (isset($condition['brand'])) {
|
|
|
282
|
+ $condition['brand'] = rawurldecode($condition['brand']);
|
|
|
283
|
+ } else {
|
|
|
284
|
+ //传品牌ID参数
|
|
|
285
|
+ if(!empty($special['brand_id'])){
|
|
|
286
|
+ $condition['brand'] = $special['brand_id'];
|
|
|
287
|
+ }
|
|
|
288
|
+ }
|
|
|
289
|
+
|
|
|
290
|
+ // 转义分类
|
|
|
291
|
+ if (isset($condition['sort'])) {
|
|
|
292
|
+ $condition['sort'] = rawurldecode($condition['sort']);
|
|
|
293
|
+ }
|
|
|
294
|
+ // 转义一级分类
|
|
|
295
|
+ if (isset($condition['msort'])) {
|
|
|
296
|
+ $condition['msort'] = rawurldecode($condition['msort']);
|
|
|
297
|
+ }
|
|
|
298
|
+ // 转义二级分类
|
|
|
299
|
+ if (isset($condition['misort'])) {
|
|
|
300
|
+ $condition['misort'] = rawurldecode($condition['misort']);
|
|
|
301
|
+ }
|
|
|
302
|
+ // 转义颜色
|
|
|
303
|
+ if (isset($condition['color'])) {
|
|
|
304
|
+ $condition['color'] = rawurldecode($condition['color']);
|
|
|
305
|
+ }
|
|
|
306
|
+ // 转义尺码
|
|
|
307
|
+ if (isset($condition['size'])) {
|
|
|
308
|
+ $condition['size'] = rawurldecode($condition['size']);
|
|
|
309
|
+ }
|
|
|
310
|
+ // 转义风格
|
|
|
311
|
+ if (isset($condition['style'])) {
|
|
|
312
|
+ $condition['style'] = rawurldecode($condition['style']);
|
|
|
313
|
+ }
|
|
|
314
|
+ // 转义价格
|
|
|
315
|
+ if (isset($condition['price'])) {
|
|
|
316
|
+ $condition['price'] = rawurldecode($condition['price']);
|
|
|
317
|
+ }
|
|
|
318
|
+ // 转换折扣
|
|
|
319
|
+ if (isset($condition['discount'])) {
|
|
|
320
|
+ $condition['p_d'] = rawurldecode($condition['discount']);
|
|
|
321
|
+ }
|
|
|
322
|
+ // 为了兼容现在运营在用的p_d
|
|
|
323
|
+ if (isset($condition['p_d'])) {
|
|
|
324
|
+ $condition['discount'] = rawurldecode($condition['p_d']);
|
|
|
325
|
+ }
|
|
|
326
|
+ // 性别参数,不传则从COOKIE获取
|
|
|
327
|
+ if (!isset($condition['gender'])) {
|
|
|
328
|
+ $condition['gender'] = Helpers::getGenderByCookie();
|
|
|
329
|
+ } else {
|
|
|
330
|
+ $condition['gender'] = rawurldecode($condition['gender']);
|
|
|
331
|
+ }
|
|
|
332
|
+
|
|
|
333
|
+ if (!$condition) {
|
|
|
334
|
+ $condition = array();
|
|
|
335
|
+ }
|
|
|
336
|
+ $goodList = $condition;
|
|
|
337
|
+ $goodList['cartUrl'] = Helpers::url('/cart/index/index', null);
|
|
|
338
|
+
|
|
|
339
|
+ $this->setTitle('专区活动');
|
|
|
340
|
+ $this->setNavHeader('专区活动', true, SITE_MAIN);
|
|
|
341
|
+
|
|
|
342
|
+ $this->_view->display('index', array(
|
|
|
343
|
+ 'goodListPage' => true,
|
|
|
344
|
+ 'showDownloadApp' => true,
|
|
|
345
|
+ 'goodList' => $goodList,
|
|
|
346
|
+ 'pageFooter' => true,
|
|
|
347
|
+ ));
|
|
|
348
|
+ }
|
231
|
} |
349
|
} |