Showing
3 changed files
with
35 additions
and
105 deletions
@@ -133,7 +133,7 @@ class HelperSearch | @@ -133,7 +133,7 @@ class HelperSearch | ||
133 | if (isset($options['controller']) && $options['controller'] == 'Search') { | 133 | if (isset($options['controller']) && $options['controller'] == 'Search') { |
134 | self::setSearchNav($data['product']['total']); | 134 | self::setSearchNav($data['product']['total']); |
135 | } | 135 | } |
136 | - $result['pathNav'] = self::$listnav; | 136 | + $result['pathNav'] = isset($options['controller']) && $options['controller'] == 'Sale' ? array() : self::$listnav; |
137 | return $result; | 137 | return $result; |
138 | } | 138 | } |
139 | 139 |
@@ -2,8 +2,7 @@ | @@ -2,8 +2,7 @@ | ||
2 | 2 | ||
3 | namespace Product; | 3 | namespace Product; |
4 | 4 | ||
5 | -use LibModels\Wap\Product\SearchData; | ||
6 | -use LibModels\Web\Product\SearchData as WebProduct; | 5 | +use Api\Yohobuy; |
7 | use Plugin\HelperSearch; | 6 | use Plugin\HelperSearch; |
8 | use Plugin\Images; | 7 | use Plugin\Images; |
9 | /** | 8 | /** |
@@ -13,33 +12,27 @@ use Plugin\Images; | @@ -13,33 +12,27 @@ use Plugin\Images; | ||
13 | class SaleModel | 12 | class SaleModel |
14 | { | 13 | { |
15 | 14 | ||
16 | - public static function getSaleSearchData($params, $options, $specialInfo) | 15 | + public static function getSaleSearchData($customCondition, $customOptions, $specialInfo) |
17 | { | 16 | { |
18 | - $data = SearchData::searchElasticByCondition($params); | 17 | + $urlList = array(); |
19 | 18 | ||
20 | - if (isset($data['code']) && $data['code'] === 200) { | ||
21 | - //获取分类列表数据 | ||
22 | - $classes = WebProduct::getClassesData(); | ||
23 | - if (isset($classes['code']) && $classes['code'] === 200) { | ||
24 | - $data['data']['filter']['group_sort'] = $classes['data']['sort']; | ||
25 | - } | ||
26 | - | ||
27 | - //用户浏览记录 | ||
28 | - | ||
29 | - // 组织模板数据 | ||
30 | - $list = HelperSearch::getList($data, $options); | ||
31 | - | ||
32 | - //删除面包屑导航数据 | ||
33 | - unset($list['pathNav']); | ||
34 | - | ||
35 | - $data = array( | ||
36 | - //初始化js | ||
37 | - 'productListPage' => true, | ||
38 | - 'newSale' => $list | ||
39 | - ); | ||
40 | - } else { | ||
41 | - $data = array(); | ||
42 | - } | 19 | + //获取$condition和$option 筛选条件和排序条件 |
20 | + $searchCondition = SearchModel::searchCondition($customCondition, $customOptions); | ||
21 | + | ||
22 | + // 组合搜索商品url | ||
23 | + $urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']); | ||
24 | + | ||
25 | + // 组合搜索分类url | ||
26 | + $urlList['sort'] = HelperSearch::getClassesUrl($searchCondition['condition']); | ||
27 | + | ||
28 | + //组合用户浏览记录url | ||
29 | + //$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']); | ||
30 | + | ||
31 | + //批量调接口 | ||
32 | + $result = Yohobuy::getMulti($urlList, array(), true); | ||
33 | + | ||
34 | + //组织模板数据格式 | ||
35 | + $data = HelperSearch::getList($result, $searchCondition['options']); | ||
43 | 36 | ||
44 | //组织sale数据 | 37 | //组织sale数据 |
45 | if (isset($specialInfo['data']) && !empty($specialInfo['data']['banner_img'])) { | 38 | if (isset($specialInfo['data']) && !empty($specialInfo['data']['banner_img'])) { |
@@ -52,15 +45,14 @@ class SaleModel | @@ -52,15 +45,14 @@ class SaleModel | ||
52 | } | 45 | } |
53 | 46 | ||
54 | //Sale首页 banner数据 | 47 | //Sale首页 banner数据 |
55 | - $data['newSale']['saleBanner']['bannerHeight'] = $special['banner'][0]['height']; | ||
56 | - $data['newSale']['saleBanner']['img'] = $special['banner'][0]['img']; | ||
57 | - $data['newSale']['saleTitle']['name'] = '全部商品'; | ||
58 | - $data['newSale']['saleTitle']['count'] = $data['newSale']['totalCount']; | ||
59 | - | 48 | + $data['saleBanner']['bannerHeight'] = $special['banner'][0]['height']; |
49 | + $data['saleBanner']['img'] = $special['banner'][0]['img']; | ||
50 | + $data['saleTitle']['name'] = '全部商品'; | ||
51 | + $data['saleTitle']['count'] = $data['totalCount']; | ||
60 | 52 | ||
61 | //获取广告位数据 | 53 | //获取广告位数据 |
62 | $nodeContent = HelperSearch::formatNodeContent($special['left_ad_code']); | 54 | $nodeContent = HelperSearch::formatNodeContent($special['left_ad_code']); |
63 | - $data['newSale']['leftContent'][]['picLink']['list'] = $nodeContent; | 55 | + $data['leftContent'][]['picLink']['list'] = $nodeContent; |
64 | 56 | ||
65 | return $data; | 57 | return $data; |
66 | } | 58 | } |
@@ -27,39 +27,11 @@ class SaleController extends WebAction | @@ -27,39 +27,11 @@ class SaleController extends WebAction | ||
27 | $this->go(SITE_MAIN); | 27 | $this->go(SITE_MAIN); |
28 | } | 28 | } |
29 | 29 | ||
30 | - /* 过滤请求参数 */ | ||
31 | $condition = array(); | 30 | $condition = array(); |
32 | - $condition = filter_input_array(INPUT_GET, array( | ||
33 | - //'query' => FILTER_SANITIZE_STRING, | ||
34 | - 'sort' => FILTER_VALIDATE_INT, | ||
35 | - 'msort' => FILTER_VALIDATE_INT, | ||
36 | - 'misort' => FILTER_VALIDATE_INT, | ||
37 | - 'color' => FILTER_VALIDATE_INT, | ||
38 | - 'size' => FILTER_VALIDATE_INT, | ||
39 | - 'style' => FILTER_DEFAULT, | ||
40 | - 'price' => FILTER_DEFAULT, | ||
41 | - 'gender' => FILTER_DEFAULT, | ||
42 | - 'p_d' => FILTER_DEFAULT, | ||
43 | - 'shelve_time' => FILTER_DEFAULT, | ||
44 | - 'isNew' => FILTER_DEFAULT, | ||
45 | - 'specialoffer' => FILTER_DEFAULT, | ||
46 | - 'limited' => FILTER_DEFAULT, | ||
47 | - 'order' => FILTER_DEFAULT, | ||
48 | - 'viewNum' => FILTER_VALIDATE_INT, | ||
49 | - 'rowNum' => FILTER_VALIDATE_INT, | ||
50 | - 'page' => FILTER_VALIDATE_INT,), false); | ||
51 | - | ||
52 | - //字符转码 | ||
53 | - if (!empty($condition)) { | ||
54 | - foreach ($condition as &$value) { | ||
55 | - $value = rawurldecode($value); | ||
56 | - } | ||
57 | - } | ||
58 | //传品牌ID参数 | 31 | //传品牌ID参数 |
59 | if(!empty($special['brand_id'])){ | 32 | if(!empty($special['brand_id'])){ |
60 | $condition['brand'] = $special['brand_id']; | 33 | $condition['brand'] = $special['brand_id']; |
61 | } | 34 | } |
62 | - | ||
63 | //传促销id | 35 | //传促销id |
64 | if(!empty($special['ispromotion'])){ | 36 | if(!empty($special['ispromotion'])){ |
65 | $condition['promotion'] = $special['ispromotion']; | 37 | $condition['promotion'] = $special['ispromotion']; |
@@ -67,52 +39,18 @@ class SaleController extends WebAction | @@ -67,52 +39,18 @@ class SaleController extends WebAction | ||
67 | $condition['promotion'] = $promotion; | 39 | $condition['promotion'] = $promotion; |
68 | } | 40 | } |
69 | 41 | ||
70 | - //获取性别数据 | ||
71 | - $gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : (!isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender'] == '2,3' ? 2 : 1)); | ||
72 | - $condition['gender'] = $gender; | ||
73 | - | ||
74 | - //每页显示商品数 | ||
75 | - if (!isset($condition['viewNum']) || empty($condition['viewNum'])) { | ||
76 | - $condition['viewNum'] = 60; | ||
77 | - } | ||
78 | - $view_num_arr = array(60, 100, 200); | ||
79 | - if (!in_array($condition['viewNum'], $view_num_arr)) { | ||
80 | - $condition['viewNum'] = 60; | ||
81 | - } | ||
82 | - //每行显示的商品数量 | ||
83 | - if (!isset($condition['rowNum']) || empty($condition['rowNum'])) { | ||
84 | - $condition['rowNum'] = 5; | ||
85 | - } | ||
86 | - if ($condition['rowNum'] == 6) { | ||
87 | - $imgSize = array(195, 260); | ||
88 | - $minImgSize = array(50, 67); | ||
89 | - } else { | ||
90 | - $condition['rowNum'] = 5; | ||
91 | - $imgSize = array(235, 314); | ||
92 | - $minImgSize = array(60, 80); | ||
93 | - } | ||
94 | - //搜索词 | ||
95 | - //$query = $this->get('query'); | ||
96 | - $condition['needFilter'] = 1; | ||
97 | $options = array( | 42 | $options = array( |
98 | - 'imgSize' => $imgSize, | ||
99 | - 'minImgSize' => $minImgSize, | ||
100 | - 'gender' => $gender, | ||
101 | - 'needPd' => 'Y', | ||
102 | - 'rowNum' => $condition['rowNum'], | ||
103 | - 'viewNum' => $condition['viewNum'], | ||
104 | - 'specialsale_id' => 'Y' | 43 | + 'specialsale_id' => 'Y', |
44 | + 'controller' => $this->_request->controller | ||
105 | ); | 45 | ); |
106 | 46 | ||
107 | - $params = $condition + $_GET; | ||
108 | - $params['attribute_not'] = 2; | ||
109 | - $params = array_filter($params); | ||
110 | - //每页记录数减1,下一页占位 | ||
111 | - $params['viewNum'] = $params['viewNum'] - 1; | ||
112 | - | ||
113 | - $data = Product\SaleModel::getSaleSearchData($params, $options, $specialInfo); | ||
114 | - $cate = array('boys', 'girls', 'kids', 'lifestyle'); | ||
115 | - $this->setWebNavHeader($cate[$gender - 1]); | 47 | + $saleData = Product\SaleModel::getSaleSearchData($condition, $options, $specialInfo); |
48 | + $data = array( | ||
49 | + //初始化js | ||
50 | + 'productListPage' => true, | ||
51 | + 'newSale' => $saleData | ||
52 | + ); | ||
53 | + $this->setWebNavHeader(); | ||
116 | //渲染模板 | 54 | //渲染模板 |
117 | $this->_view->display('new-sale', $data); | 55 | $this->_view->display('new-sale', $data); |
118 | } | 56 | } |
-
Please register or login to post a comment