Showing
3 changed files
with
37 additions
and
33 deletions
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use Action\AbstractAction; | 3 | use Action\AbstractAction; |
4 | -// use LibModels\Wap\Product\SearchData; | ||
5 | -// use Plugin\DataProcess\ListProcess; | 4 | +use LibModels\Wap\Product\SearchData; |
5 | +use Plugin\DataProcess\ListProcess; | ||
6 | use Plugin\Helpers; | 6 | use Plugin\Helpers; |
7 | 7 | ||
8 | /** | 8 | /** |
@@ -39,6 +39,7 @@ class SearchController extends AbstractAction | @@ -39,6 +39,7 @@ class SearchController extends AbstractAction | ||
39 | 'shop' => FILTER_DEFAULT, | 39 | 'shop' => FILTER_DEFAULT, |
40 | 'categoryId' => FILTER_DEFAULT, | 40 | 'categoryId' => FILTER_DEFAULT, |
41 | 'subCategoryId' => FILTER_DEFAULT, | 41 | 'subCategoryId' => FILTER_DEFAULT, |
42 | + 'title' => FILTER_DEFAULT, | ||
42 | 'query' => FILTER_DEFAULT, | 43 | 'query' => FILTER_DEFAULT, |
43 | 'brand' => FILTER_DEFAULT, | 44 | 'brand' => FILTER_DEFAULT, |
44 | 'sort' => FILTER_DEFAULT, | 45 | 'sort' => FILTER_DEFAULT, |
@@ -151,13 +152,11 @@ class SearchController extends AbstractAction | @@ -151,13 +152,11 @@ class SearchController extends AbstractAction | ||
151 | if ($isQueryFirstClass) { | 152 | if ($isQueryFirstClass) { |
152 | $this->setTitle('全部' . $query); | 153 | $this->setTitle('全部' . $query); |
153 | $this->setNavHeader('全部' . $query, true, SITE_MAIN); | 154 | $this->setNavHeader('全部' . $query, true, SITE_MAIN); |
154 | - } | ||
155 | - // 搜索是二级品类 | 155 | + } // 搜索是二级品类 |
156 | elseif ($isQuerySecondClass) { | 156 | elseif ($isQuerySecondClass) { |
157 | $this->setTitle($query); | 157 | $this->setTitle($query); |
158 | $this->setNavHeader($query, true, SITE_MAIN); | 158 | $this->setNavHeader($query, true, SITE_MAIN); |
159 | - } | ||
160 | - // 搜索其它内容 | 159 | + } // 搜索其它内容 |
161 | else { | 160 | else { |
162 | $from = $this->get('from'); | 161 | $from = $this->get('from'); |
163 | if ($haveQuery || $from) { | 162 | if ($haveQuery || $from) { |
@@ -196,6 +195,11 @@ class SearchController extends AbstractAction | @@ -196,6 +195,11 @@ class SearchController extends AbstractAction | ||
196 | $listData = array(); | 195 | $listData = array(); |
197 | } | 196 | } |
198 | 197 | ||
198 | + if($condition['title']){ | ||
199 | + $this->setTitle($condition['title']); | ||
200 | + $this->setNavHeader($condition['title'], true, SITE_MAIN); | ||
201 | + } | ||
202 | + | ||
199 | $this->_view->display('list', $data); | 203 | $this->_view->display('list', $data); |
200 | } | 204 | } |
201 | 205 | ||
@@ -254,8 +258,7 @@ class SearchController extends AbstractAction | @@ -254,8 +258,7 @@ class SearchController extends AbstractAction | ||
254 | // 为了兼容现在运营在用的p_d | 258 | // 为了兼容现在运营在用的p_d |
255 | if (isset($condition['p_d'])) { | 259 | if (isset($condition['p_d'])) { |
256 | $condition['p_d'] = rawurldecode($condition['p_d']); | 260 | $condition['p_d'] = rawurldecode($condition['p_d']); |
257 | - } | ||
258 | - // 转换折扣 | 261 | + } // 转换折扣 |
259 | elseif (isset($condition['discount'])) { | 262 | elseif (isset($condition['discount'])) { |
260 | $condition['p_d'] = rawurldecode($condition['discount']); | 263 | $condition['p_d'] = rawurldecode($condition['discount']); |
261 | unset($condition['discount']); | 264 | unset($condition['discount']); |
@@ -345,8 +348,7 @@ class SearchController extends AbstractAction | @@ -345,8 +348,7 @@ class SearchController extends AbstractAction | ||
345 | // 为了兼容现在运营在用的p_d | 348 | // 为了兼容现在运营在用的p_d |
346 | if (isset($condition['p_d'])) { | 349 | if (isset($condition['p_d'])) { |
347 | $condition['p_d'] = rawurldecode($condition['p_d']); | 350 | $condition['p_d'] = rawurldecode($condition['p_d']); |
348 | - } | ||
349 | - // 转换折扣 | 351 | + } // 转换折扣 |
350 | elseif (isset($condition['discount'])) { | 352 | elseif (isset($condition['discount'])) { |
351 | $condition['p_d'] = rawurldecode($condition['discount']); | 353 | $condition['p_d'] = rawurldecode($condition['discount']); |
352 | unset($condition['discount']); | 354 | unset($condition['discount']); |
@@ -5,6 +5,7 @@ namespace Product; | @@ -5,6 +5,7 @@ namespace Product; | ||
5 | use Configs\CacheConfig; | 5 | use Configs\CacheConfig; |
6 | use LibModels\Wap\Category\ClassData; | 6 | use LibModels\Wap\Category\ClassData; |
7 | use LibModels\Wap\Category\BrandData; | 7 | use LibModels\Wap\Category\BrandData; |
8 | +use LibModels\Wap\Product\ShopData; | ||
8 | use Plugin\DataProcess\ListProcess; | 9 | use Plugin\DataProcess\ListProcess; |
9 | use Plugin\Helpers; | 10 | use Plugin\Helpers; |
10 | use Plugin\Cache; | 11 | use Plugin\Cache; |
@@ -57,8 +58,7 @@ class ListModel | @@ -57,8 +58,7 @@ class ListModel | ||
57 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. | 58 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. |
58 | if (empty($result)) { | 59 | if (empty($result)) { |
59 | $result = Cache::get($key, 'slave'); | 60 | $result = Cache::get($key, 'slave'); |
60 | - } | ||
61 | - // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 | 61 | + } // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 |
62 | else { | 62 | else { |
63 | Cache::set($key, $result, 1800); // 缓存30分钟 | 63 | Cache::set($key, $result, 1800); // 缓存30分钟 |
64 | } | 64 | } |
@@ -140,8 +140,7 @@ class ListModel | @@ -140,8 +140,7 @@ class ListModel | ||
140 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. | 140 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. |
141 | if (empty($result)) { | 141 | if (empty($result)) { |
142 | $result = Cache::get($key, 'slave'); | 142 | $result = Cache::get($key, 'slave'); |
143 | - } | ||
144 | - // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 | 143 | + } // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 |
145 | else { | 144 | else { |
146 | Cache::set($key, $result, 1800); // 缓存30分钟 | 145 | Cache::set($key, $result, 1800); // 缓存30分钟 |
147 | } | 146 | } |
@@ -186,8 +185,7 @@ class ListModel | @@ -186,8 +185,7 @@ class ListModel | ||
186 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. | 185 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. |
187 | if (empty($result)) { | 186 | if (empty($result)) { |
188 | $result = Cache::get($key, 'slave'); | 187 | $result = Cache::get($key, 'slave'); |
189 | - } | ||
190 | - // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 | 188 | + } // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 |
191 | else { | 189 | else { |
192 | Cache::set($key, $result); // 缓存1小时 | 190 | Cache::set($key, $result); // 缓存1小时 |
193 | } | 191 | } |
@@ -233,8 +231,7 @@ class ListModel | @@ -233,8 +231,7 @@ class ListModel | ||
233 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. | 231 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. |
234 | if (empty($result)) { | 232 | if (empty($result)) { |
235 | $result = Cache::get($key, 'slave'); | 233 | $result = Cache::get($key, 'slave'); |
236 | - } | ||
237 | - // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 | 234 | + } // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 |
238 | else { | 235 | else { |
239 | Cache::set($key, $result); // 缓存1小时 | 236 | Cache::set($key, $result); // 缓存1小时 |
240 | } | 237 | } |
@@ -284,8 +281,7 @@ class ListModel | @@ -284,8 +281,7 @@ class ListModel | ||
284 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. | 281 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. |
285 | if (empty($result)) { | 282 | if (empty($result)) { |
286 | $result = Cache::get($key, 'slave'); | 283 | $result = Cache::get($key, 'slave'); |
287 | - } | ||
288 | - // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 | 284 | + } // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 |
289 | else { | 285 | else { |
290 | Cache::set($key, $result); | 286 | Cache::set($key, $result); |
291 | } | 287 | } |
@@ -335,8 +331,7 @@ class ListModel | @@ -335,8 +331,7 @@ class ListModel | ||
335 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. | 331 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. |
336 | if (empty($result)) { | 332 | if (empty($result)) { |
337 | $result = Cache::get($key, 'slave'); | 333 | $result = Cache::get($key, 'slave'); |
338 | - } | ||
339 | - // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 | 334 | + } // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 |
340 | else { | 335 | else { |
341 | Cache::set($key, $result); | 336 | Cache::set($key, $result); |
342 | } | 337 | } |
@@ -347,10 +342,11 @@ class ListModel | @@ -347,10 +342,11 @@ class ListModel | ||
347 | 342 | ||
348 | /** | 343 | /** |
349 | * @param $data | 344 | * @param $data |
345 | + * @param $shop_id | ||
350 | * @return array 返回的处理好的数据 | 346 | * @return array 返回的处理好的数据 |
351 | * @author chengyao.guo | 347 | * @author chengyao.guo |
352 | */ | 348 | */ |
353 | - public static function categoryData($data) | 349 | + public static function categoryData($data , $shop_id) |
354 | { | 350 | { |
355 | $result = array(); | 351 | $result = array(); |
356 | $result['class'] = array(); | 352 | $result['class'] = array(); |
@@ -358,9 +354,13 @@ class ListModel | @@ -358,9 +354,13 @@ class ListModel | ||
358 | foreach ($data as &$item) { | 354 | foreach ($data as &$item) { |
359 | array_push($result['class'], array('name' => $item['category_name'])); | 355 | array_push($result['class'], array('name' => $item['category_name'])); |
360 | foreach ($item['sub'] as &$item2) { | 356 | foreach ($item['sub'] as &$item2) { |
361 | - $item2['url'] = Helpers::url('/search/list',array( | ||
362 | - 'shop' => '326' | ||
363 | - )); // tar mark 还有其他参数 | 357 | + $item2['url'] = Helpers::url('/search/list', array( |
358 | + 'shop' => $shop_id, | ||
359 | + 'categoryId' => $item['category_id'], | ||
360 | + 'subCategoryId' => $item2['category_id'], | ||
361 | + 'title' => $item2['category_name'], | ||
362 | + 'query' => $item2['category_name'], | ||
363 | + )); | ||
364 | } | 364 | } |
365 | array_push($result['category'], array('subcategory' => $item['sub'])); | 365 | array_push($result['category'], array('subcategory' => $item['sub'])); |
366 | } | 366 | } |
@@ -371,14 +371,19 @@ class ListModel | @@ -371,14 +371,19 @@ class ListModel | ||
371 | * 店铺所有品牌信息处理 | 371 | * 店铺所有品牌信息处理 |
372 | * @author chengyao.guo | 372 | * @author chengyao.guo |
373 | * @param $data | 373 | * @param $data |
374 | + * @param $shop_id | ||
374 | * @return mixed | 375 | * @return mixed |
375 | */ | 376 | */ |
376 | - public static function brandData($data) | 377 | + public static function brandData($data,$shop_id) |
377 | { | 378 | { |
378 | // 处理图片链接 | 379 | // 处理图片链接 |
379 | foreach ($data as &$item) { | 380 | foreach ($data as &$item) { |
380 | $item['brand_ico'] = Images::getImageUrl($item['brand_ico'], 0, 0); | 381 | $item['brand_ico'] = Images::getImageUrl($item['brand_ico'], 0, 0); |
381 | - $item['url'] = Helpers::url('',array(),$item['brand_domain']); | 382 | + $item['url'] = Helpers::url('/search/list', array( |
383 | + 'shop' => $shop_id, | ||
384 | + 'brand' => $item['brand_id'], | ||
385 | + 'title' => $item['brand_name'], | ||
386 | + )); | ||
382 | } | 387 | } |
383 | return $data; | 388 | return $data; |
384 | } | 389 | } |
@@ -255,9 +255,8 @@ class IndexController extends AbstractAction | @@ -255,9 +255,8 @@ class IndexController extends AbstractAction | ||
255 | $result = array(); | 255 | $result = array(); |
256 | $resource = ShopData::getShopBrands($requestData['shop_id']); | 256 | $resource = ShopData::getShopBrands($requestData['shop_id']); |
257 | if($resource['code'] === 200){ | 257 | if($resource['code'] === 200){ |
258 | - $result = ListModel::brandData($resource['data']); | 258 | + $result = ListModel::brandData($resource['data'],$requestData['shop_id']); |
259 | } | 259 | } |
260 | -// ShopData::debugOut($resource); | ||
261 | if(Mobile::isMobile()){ | 260 | if(Mobile::isMobile()){ |
262 | $this->setTitle('品牌'); | 261 | $this->setTitle('品牌'); |
263 | }else{ | 262 | }else{ |
@@ -285,14 +284,13 @@ class IndexController extends AbstractAction | @@ -285,14 +284,13 @@ class IndexController extends AbstractAction | ||
285 | $result = array(); | 284 | $result = array(); |
286 | $resource = ShopData::getShopCategory($requestData['shop_id'], Helpers::getChannelByCookie(), Helpers::getGenderByCookie()); | 285 | $resource = ShopData::getShopCategory($requestData['shop_id'], Helpers::getChannelByCookie(), Helpers::getGenderByCookie()); |
287 | if ($resource['code'] === 200) { | 286 | if ($resource['code'] === 200) { |
288 | - $result = ListModel::categoryData($resource['data']); | 287 | + $result = ListModel::categoryData($resource['data'],$requestData['shop_id']); |
289 | } | 288 | } |
290 | if(Mobile::isMobile()){ | 289 | if(Mobile::isMobile()){ |
291 | $this->setTitle('品类'); | 290 | $this->setTitle('品类'); |
292 | }else{ | 291 | }else{ |
293 | $this->setNavHeader('品类', true, SITE_MAIN); | 292 | $this->setNavHeader('品类', true, SITE_MAIN); |
294 | } | 293 | } |
295 | -// ShopData::debugOut($resource); | ||
296 | return $this->_view->display('category', array( | 294 | return $this->_view->display('category', array( |
297 | 'productCategoryPage' => true, | 295 | 'productCategoryPage' => true, |
298 | 'content' => $result, | 296 | 'content' => $result, |
@@ -322,7 +320,6 @@ class IndexController extends AbstractAction | @@ -322,7 +320,6 @@ class IndexController extends AbstractAction | ||
322 | }else{ | 320 | }else{ |
323 | $this->setNavHeader('店铺简介', true, SITE_MAIN); | 321 | $this->setNavHeader('店铺简介', true, SITE_MAIN); |
324 | } | 322 | } |
325 | -// ShopData::debugOut($resource); | ||
326 | return $this->_view->display('intro', array( | 323 | return $this->_view->display('intro', array( |
327 | 'content' => $result, | 324 | 'content' => $result, |
328 | )); | 325 | )); |
-
Please register or login to post a comment