Showing
7 changed files
with
47 additions
and
8 deletions
@@ -78,10 +78,11 @@ class NewsaleData | @@ -78,10 +78,11 @@ class NewsaleData | ||
78 | * | 78 | * |
79 | * @return array 根据指定条件筛选出来的商品 | 79 | * @return array 根据指定条件筛选出来的商品 |
80 | */ | 80 | */ |
81 | - public static function selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit = null, $limit = 60, $page = 1, $order = 's_t_desc', $shop) | 81 | + public static function selectNewSaleProducts($gender, $age_level, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit = null, $limit = 60, $page = 1, $order = 's_t_desc', $shop) |
82 | { | 82 | { |
83 | $selectItems = array( | 83 | $selectItems = array( |
84 | 'gender' => $gender, | 84 | 'gender' => $gender, |
85 | + 'age_level' => $age_level, | ||
85 | 'brand' => $brand, | 86 | 'brand' => $brand, |
86 | 'shop_id' => $shop, | 87 | 'shop_id' => $shop, |
87 | 'sort' => $sort, | 88 | 'sort' => $sort, |
@@ -92,13 +93,20 @@ class NewsaleData | @@ -92,13 +93,20 @@ class NewsaleData | ||
92 | 'dayLimit' => $dayLimit | 93 | 'dayLimit' => $dayLimit |
93 | ); | 94 | ); |
94 | // 拉取筛选参数 | 95 | // 拉取筛选参数 |
95 | - $queriedParams = array_filter($selectItems, function($v) { | ||
96 | - return !empty($v); | ||
97 | - }); | 96 | + if (isset($selectItems['age_level']) && $selectItems['age_level'] === '0'){ |
97 | + $queriedParams = array_filter($selectItems, function($v) { | ||
98 | + return !empty($v); | ||
99 | + }); | ||
100 | + $queriedParams['age_level'] = '0'; | ||
101 | + }else { | ||
102 | + $queriedParams = array_filter($selectItems, function($v) { | ||
103 | + return !empty($v); | ||
104 | + }); | ||
105 | + } | ||
98 | 106 | ||
99 | $param = Yohobuy::param(); | 107 | $param = Yohobuy::param(); |
100 | if (!is_null($dayLimit)) { | 108 | if (!is_null($dayLimit)) { |
101 | - $param['method'] = 'app.search.newProduct'; | 109 | + $param['method'] = 'app.search.sales'; |
102 | } else { | 110 | } else { |
103 | $param['method'] = 'app.search.sales'; | 111 | $param['method'] = 'app.search.sales'; |
104 | $param['p_d'] = '0.1,0.9'; | 112 | $param['p_d'] = '0.1,0.9'; |
@@ -211,6 +211,11 @@ function search(opt) { | @@ -211,6 +211,11 @@ function search(opt) { | ||
211 | color: opt.id | 211 | color: opt.id |
212 | }; | 212 | }; |
213 | break; | 213 | break; |
214 | + case 'ageLevel': | ||
215 | + ext = { | ||
216 | + age_level: opt.id | ||
217 | + }; | ||
218 | + break; | ||
214 | case 'size': | 219 | case 'size': |
215 | ext = { | 220 | ext = { |
216 | size: opt.id | 221 | size: opt.id |
@@ -109,6 +109,11 @@ function search(opt) { | @@ -109,6 +109,11 @@ function search(opt) { | ||
109 | brand: opt.id | 109 | brand: opt.id |
110 | }; | 110 | }; |
111 | break; | 111 | break; |
112 | + case 'ageLevel': | ||
113 | + ext = { | ||
114 | + age_level: opt.id | ||
115 | + }; | ||
116 | + break; | ||
112 | case 'sort': | 117 | case 'sort': |
113 | ext = { | 118 | ext = { |
114 | sort: opt.id | 119 | sort: opt.id |
@@ -128,6 +128,11 @@ function search(opt) { | @@ -128,6 +128,11 @@ function search(opt) { | ||
128 | color: opt.id | 128 | color: opt.id |
129 | }; | 129 | }; |
130 | break; | 130 | break; |
131 | + case 'ageLevel': | ||
132 | + ext = { | ||
133 | + age_level: opt.id | ||
134 | + }; | ||
135 | + break; | ||
131 | case 'size': | 136 | case 'size': |
132 | ext = { | 137 | ext = { |
133 | size: opt.id | 138 | size: opt.id |
@@ -58,6 +58,10 @@ | @@ -58,6 +58,10 @@ | ||
58 | <input class="query-param" type="hidden" data-attr="p_d" value="{{p_d}}"> | 58 | <input class="query-param" type="hidden" data-attr="p_d" value="{{p_d}}"> |
59 | {{/if}} | 59 | {{/if}} |
60 | 60 | ||
61 | +{{#if age_level}} | ||
62 | + <input class="query-param" type="hidden" data-attr="age_level" value="{{age_level}}"> | ||
63 | +{{/if}} | ||
64 | + | ||
61 | {{#if channel}} | 65 | {{#if channel}} |
62 | <input class="query-param" type="hidden" data-attr="channel" value="{{channel}}"> | 66 | <input class="query-param" type="hidden" data-attr="channel" value="{{channel}}"> |
63 | {{/if}} | 67 | {{/if}} |
@@ -250,6 +250,7 @@ class SearchController extends AbstractAction | @@ -250,6 +250,7 @@ class SearchController extends AbstractAction | ||
250 | 'channel' => FILTER_DEFAULT, | 250 | 'channel' => FILTER_DEFAULT, |
251 | 'p_d' => FILTER_DEFAULT, | 251 | 'p_d' => FILTER_DEFAULT, |
252 | 'outlets' => FILTER_DEFAULT, | 252 | 'outlets' => FILTER_DEFAULT, |
253 | + 'age_level' => FILTER_DEFAULT, | ||
253 | 'page' => FILTER_VALIDATE_INT,), false); | 254 | 'page' => FILTER_VALIDATE_INT,), false); |
254 | 255 | ||
255 | if (!empty($condition['shop_id'])) { | 256 | if (!empty($condition['shop_id'])) { |
@@ -298,6 +299,10 @@ class SearchController extends AbstractAction | @@ -298,6 +299,10 @@ class SearchController extends AbstractAction | ||
298 | if (isset($condition['gender'])) { | 299 | if (isset($condition['gender'])) { |
299 | $condition['gender'] = rawurldecode($condition['gender']); | 300 | $condition['gender'] = rawurldecode($condition['gender']); |
300 | } | 301 | } |
302 | + // 转义性别 | ||
303 | + if (isset($condition['age_level'])) { | ||
304 | + $condition['age_level'] = rawurldecode($condition['age_level']); | ||
305 | + } | ||
301 | if (isset($condition['query'])) { | 306 | if (isset($condition['query'])) { |
302 | $condition['query'] = rawurldecode($condition['query']); | 307 | $condition['query'] = rawurldecode($condition['query']); |
303 | } | 308 | } |
@@ -321,7 +326,12 @@ class SearchController extends AbstractAction | @@ -321,7 +326,12 @@ class SearchController extends AbstractAction | ||
321 | $tagSale = $this->get('tagSale', 0); | 326 | $tagSale = $this->get('tagSale', 0); |
322 | $tagSale = $tagSale === 0 ? true : false; | 327 | $tagSale = $tagSale === 0 ? true : false; |
323 | // 过滤掉值为空的条件 | 328 | // 过滤掉值为空的条件 |
324 | - $condition = array_filter($condition); | 329 | + if (isset($condition['age_level']) && $condition['age_level'] === '0'){ //年龄删选的成人id为0 |
330 | + $condition = array_filter($condition); | ||
331 | + $condition['age_level'] = '0'; | ||
332 | + }else{ | ||
333 | + $condition = array_filter($condition); | ||
334 | + } | ||
325 | 335 | ||
326 | // /* 模糊搜索关键词 */ | 336 | // /* 模糊搜索关键词 */ |
327 | // if (isset($condition['query'])) { | 337 | // if (isset($condition['query'])) { |
@@ -133,6 +133,7 @@ class NewsaleController extends AbstractAction | @@ -133,6 +133,7 @@ class NewsaleController extends AbstractAction | ||
133 | 133 | ||
134 | if ($this->isAjax()) { | 134 | if ($this->isAjax()) { |
135 | $gender = $this->get('gender') ? $this->get('gender') : Helpers::getGenderByCookie(); | 135 | $gender = $this->get('gender') ? $this->get('gender') : Helpers::getGenderByCookie(); |
136 | + $age_level = $this->get('age_level', null); | ||
136 | $brand = $this->get('brand', null); | 137 | $brand = $this->get('brand', null); |
137 | $sort = $this->get('sort', null); | 138 | $sort = $this->get('sort', null); |
138 | $color = $this->get('color', null); | 139 | $color = $this->get('color', null); |
@@ -166,7 +167,7 @@ class NewsaleController extends AbstractAction | @@ -166,7 +167,7 @@ class NewsaleController extends AbstractAction | ||
166 | } | 167 | } |
167 | 168 | ||
168 | $data = NewsaleData::selectNewSaleProducts( | 169 | $data = NewsaleData::selectNewSaleProducts( |
169 | - $gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order, null | 170 | + $gender, '0', $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order, null |
170 | ); | 171 | ); |
171 | $result = \Product\NewsaleModel::selectData($data); | 172 | $result = \Product\NewsaleModel::selectData($data); |
172 | } | 173 | } |
@@ -188,6 +189,7 @@ class NewsaleController extends AbstractAction | @@ -188,6 +189,7 @@ class NewsaleController extends AbstractAction | ||
188 | 189 | ||
189 | if ($this->isAjax()) { | 190 | if ($this->isAjax()) { |
190 | $gender = $this->get('gender') ? $this->get('gender') : Helpers::getGenderByCookie(); | 191 | $gender = $this->get('gender') ? $this->get('gender') : Helpers::getGenderByCookie(); |
192 | + $age_level = $this->get('$age_level', null); | ||
191 | $brand = $this->get('brand', null); | 193 | $brand = $this->get('brand', null); |
192 | $shop = $this->get('shop_id', null); | 194 | $shop = $this->get('shop_id', null); |
193 | $sort = $this->get('sort', null); | 195 | $sort = $this->get('sort', null); |
@@ -206,7 +208,7 @@ class NewsaleController extends AbstractAction | @@ -206,7 +208,7 @@ class NewsaleController extends AbstractAction | ||
206 | 208 | ||
207 | $channel = $this->get('channel') ? $this->get('channel') : Helpers::getChannelByCookie(); | 209 | $channel = $this->get('channel') ? $this->get('channel') : Helpers::getChannelByCookie(); |
208 | $data = NewsaleData::selectNewSaleProducts( | 210 | $data = NewsaleData::selectNewSaleProducts( |
209 | - $gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order, $shop | 211 | + $gender, $age_level, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order, $shop |
210 | ); | 212 | ); |
211 | $result = \Product\NewsaleModel::filterData($data, $gender); | 213 | $result = \Product\NewsaleModel::filterData($data, $gender); |
212 | } | 214 | } |
-
Please register or login to post a comment