Authored by 梁志锋

merge feature/sale分支

... ... @@ -34,6 +34,13 @@
<input class="query-param" type="hidden" data-attr="discount" value="{{discount}}">
{{/if}}
{{#if specialsale_id}}
<input class="query-param" type="hidden" data-attr="specialsale_id" value="{{specialsale_id}}">
{{/if}}
{{#if promotion}}
<input class="query-param" type="hidden" data-attr="promotion" value="{{promotion}}">
{{/if}}
{{#if query}}
<input class="query-param" type="hidden" data-attr="query" value="{{query}}">
{{/if}}
... ...
... ... @@ -96,10 +96,10 @@ class Bootstrap extends Bootstrap_Abstract
case 'cart': // 购物车
$module = 'Cart';
break;
// case 'sale': // 专区活动
// $module = 'Product';
// $action = 'Sale';
// break;
case 'sale': // 专区活动
$module = 'Product';
$action = 'Sale';
break;
default: // 其它(识别为品牌)
$module = 'Product';
$action = 'Brand';
... ...
... ... @@ -210,6 +210,8 @@ class SearchController extends AbstractAction
/* 过滤请求参数 */
$condition = filter_input_array(INPUT_GET, array(
'query' => FILTER_DEFAULT,
'specialsale_id' => FILTER_DEFAULT,
'promotion' => FILTER_DEFAULT,
'brand' => FILTER_DEFAULT,
'sort' => FILTER_DEFAULT,
'msort' => FILTER_DEFAULT,
... ... @@ -234,6 +236,13 @@ class SearchController extends AbstractAction
if (isset($condition['misort'])) {
$condition['misort'] = rawurldecode($condition['misort']);
}
// 转义活动ID
if (isset($condition['specialsale_id'])) {
$condition['specialsale_id'] = rawurldecode($condition['specialsale_id']);
}
if (isset($condition['promotion'])) {
$condition['promotion'] = rawurldecode($condition['promotion']);
}
// 转义颜色
if (isset($condition['color'])) {
$condition['color'] = rawurldecode($condition['color']);
... ...
<?php
use Action\AbstractAction;
use LibModels\Web\Product\SaleData;
use Plugin\Helpers;
/**
... ... @@ -228,4 +229,121 @@ class IndexController extends AbstractAction
$this->_view->display('index', $data);
}
/**
* 活动专区
*
* @param int channel 1:男生,2:女生,3:潮童,4:创意生活
*/
public function saleAction()
{
// 过滤请求参数
$condition = filter_input_array(INPUT_GET, array(
'brand' => FILTER_DEFAULT,
'specialsale_id' => FILTER_DEFAULT,
'promotion' => FILTER_DEFAULT,
'sort' => FILTER_DEFAULT,
'msort' => FILTER_DEFAULT,
'misort' => FILTER_DEFAULT,
'color' => FILTER_DEFAULT,
'size' => FILTER_DEFAULT,
'style' => FILTER_DEFAULT,
'price' => FILTER_DEFAULT,
'discount' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,), false);
//专区ID和促销ID都为空时,跳转到主页
if (!isset($condition['specialsale_id']) && isset($condition['promotion'])) {
$this->go(SITE_MAIN);
}
// 转义活动ID
if (isset($condition['specialsale_id'])) {
$condition['specialsale_id'] = rawurldecode($condition['specialsale_id']);
}
if (isset($condition['promotion'])) {
$condition['promotion'] = rawurldecode($condition['promotion']);
}
// 获取促销信息
$special = array();
$specialInfo = SaleData::getSpecial($condition['specialsale_id']);
if(isset($specialInfo['data'])) {
$special = $specialInfo['data'];
}
//传促销id,促销id为空时传专区id
if(!empty($special['ispromotion'])){
$condition['promotion'] = $special['ispromotion'];
}
// 转义品牌
if (isset($condition['brand'])) {
$condition['brand'] = rawurldecode($condition['brand']);
} else {
//传品牌ID参数
if(!empty($special['brand_id'])){
$condition['brand'] = $special['brand_id'];
}
}
// 转义分类
if (isset($condition['sort'])) {
$condition['sort'] = rawurldecode($condition['sort']);
}
// 转义一级分类
if (isset($condition['msort'])) {
$condition['msort'] = rawurldecode($condition['msort']);
}
// 转义二级分类
if (isset($condition['misort'])) {
$condition['misort'] = rawurldecode($condition['misort']);
}
// 转义颜色
if (isset($condition['color'])) {
$condition['color'] = rawurldecode($condition['color']);
}
// 转义尺码
if (isset($condition['size'])) {
$condition['size'] = rawurldecode($condition['size']);
}
// 转义风格
if (isset($condition['style'])) {
$condition['style'] = rawurldecode($condition['style']);
}
// 转义价格
if (isset($condition['price'])) {
$condition['price'] = rawurldecode($condition['price']);
}
// 转换折扣
if (isset($condition['discount'])) {
$condition['p_d'] = rawurldecode($condition['discount']);
}
// 为了兼容现在运营在用的p_d
if (isset($condition['p_d'])) {
$condition['discount'] = rawurldecode($condition['p_d']);
}
// 性别参数,不传则从COOKIE获取
if (!isset($condition['gender'])) {
$condition['gender'] = Helpers::getGenderByCookie();
} else {
$condition['gender'] = rawurldecode($condition['gender']);
}
if (!$condition) {
$condition = array();
}
$goodList = $condition;
$goodList['cartUrl'] = Helpers::url('/cart/index/index', null);
$this->setTitle('专区活动');
$this->setNavHeader('专区活动', true, SITE_MAIN);
$this->_view->display('index', array(
'goodListPage' => true,
'showDownloadApp' => true,
'goodList' => $goodList,
'pageFooter' => true,
));
}
}
... ...