Authored by 周少峰

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into feature/web-list

@@ -131,7 +131,7 @@ class HelperSearch @@ -131,7 +131,7 @@ class HelperSearch
131 if (isset($options['controller']) && $options['controller'] == 'Search') { 131 if (isset($options['controller']) && $options['controller'] == 'Search') {
132 self::setSearchNav($data['product']['total']); 132 self::setSearchNav($data['product']['total']);
133 } 133 }
134 - $result['pathNav'] = self::$listnav; 134 + $result['pathNav'] = isset($options['controller']) && $options['controller'] == 'Sale' ? array() : self::$listnav;
135 return $result; 135 return $result;
136 } 136 }
137 137
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 </span> 21 </span>
22 {{/ comments}} 22 {{/ comments}}
23 </div> 23 </div>
24 - <a class="comment-content-footer tap-hightlight" href="{{commentsUrl}}"> 24 + <a class="comment-content-footer tap-hightlight" href="{{commentsUrl}}">
25 查看更多 25 查看更多
26 <span class="iconfont">&#xe604;</span> 26 <span class="iconfont">&#xe604;</span>
27 </a> 27 </a>
@@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
37 <div class="consult-content-main content-main"> 37 <div class="consult-content-main content-main">
38 {{# consults}} 38 {{# consults}}
39 <div class="question"> 39 <div class="question">
40 - <span class="iconfont">&#xe639;</span> 40 + <span class="iconfont">&#xe644;</span>
41 <p> 41 <p>
42 {{question}}<br> 42 {{question}}<br>
43 <span class="time">{{time}}</span> 43 <span class="time">{{time}}</span>
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 </div> 45 </div>
46 46
47 <div class="answer"> 47 <div class="answer">
48 - <span class="iconfont">&#xe63f;</span> 48 + <span class="iconfont">&#xe642;</span>
49 <p>{{answer}}</p> 49 <p>{{answer}}</p>
50 </div> 50 </div>
51 {{/ consults}} 51 {{/ consults}}
@@ -18,7 +18,7 @@ moreUnicode = { @@ -18,7 +18,7 @@ moreUnicode = {
18 //品牌相关变量 18 //品牌相关变量
19 var $brandDefault = $('.brand .default'), 19 var $brandDefault = $('.brand .default'),
20 $brandPanel = $('.brand .brand-panel'), 20 $brandPanel = $('.brand .brand-panel'),
21 - $brandAttrs = $('.brand .attr'), 21 + $brandAttrs = $brandPanel.find('.attr'),
22 $brandMore = $('#brand-more'), 22 $brandMore = $('#brand-more'),
23 $brandMulti = $('#brand-multi'); 23 $brandMulti = $('#brand-multi');
24 24
@@ -55,6 +55,10 @@ @@ -55,6 +55,10 @@
55 55
56 -moz-user-select: none; 56 -moz-user-select: none;
57 } 57 }
  58 +
  59 + .color .attr {
  60 + margin-right: 0;
  61 + }
58 62
59 .checked-conditions { 63 .checked-conditions {
60 line-height: 30px; 64 line-height: 30px;
@@ -85,6 +89,10 @@ @@ -85,6 +89,10 @@
85 color: #999; 89 color: #999;
86 float: right; 90 float: right;
87 } 91 }
  92 +
  93 + .close {
  94 + font-size: 14px;
  95 + }
88 } 96 }
89 97
90 .sort-pre .active .attr { 98 .sort-pre .active .attr {
@@ -163,7 +171,7 @@ @@ -163,7 +171,7 @@
163 margin-right: 5px; 171 margin-right: 5px;
164 172
165 span { 173 span {
166 - margin: 0 2px; 174 + margin: 0 3px;
167 cursor: pointer; 175 cursor: pointer;
168 -moz-user-select: none; 176 -moz-user-select: none;
169 177
@@ -190,9 +198,12 @@ @@ -190,9 +198,12 @@
190 } 198 }
191 199
192 .btn { 200 .btn {
  201 + position: relative;
193 display: inline-block; 202 display: inline-block;
  203 + top: -1px;
194 width: 55px; 204 width: 55px;
195 - height: 18px; 205 + height: 20px;
  206 + line-height: 20px;
196 background: #3a3a3a; 207 background: #3a3a3a;
197 color: #fff; 208 color: #fff;
198 text-align: center; 209 text-align: center;
@@ -230,8 +241,8 @@ @@ -230,8 +241,8 @@
230 border: none; 241 border: none;
231 background: #000; 242 background: #000;
232 color: #fff; 243 color: #fff;
233 - font-size: 15px;  
234 - margin-right: 15px; 244 + font-size: 14px;
  245 + margin-right: 20px;
235 cursor: pointer; 246 cursor: pointer;
236 247
237 &.dis { 248 &.dis {
@@ -335,9 +346,19 @@ @@ -335,9 +346,19 @@
335 346
336 .checkbox { 347 .checkbox {
337 display: none; 348 display: none;
  349 + float: left;
338 } 350 }
339 351
340 .multi .checkbox { 352 .multi .checkbox {
341 - display: inline; 353 + display: block;
  354 + color: #ccc;
  355 + font-size: 12px;
  356 + margin-right: 3px;
342 } 357 }
343 } 358 }
  359 +
  360 +@media (max-width: 1180px) {
  361 + .filter-box .brand .attr {
  362 + width: 25%;
  363 + }
  364 +}
@@ -45,10 +45,6 @@ @@ -45,10 +45,6 @@
45 } 45 }
46 } 46 }
47 47
48 - .panel-body .attr {  
49 - width: 25%;  
50 - }  
51 -  
52 .filter-box .brand .attr-content { 48 .filter-box .brand .attr-content {
53 max-width: 730px; 49 max-width: 730px;
54 } 50 }
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 6
7 .sort-type, 7 .sort-type,
8 .checks { 8 .checks {
9 - color: #ccc; 9 + color: #999;
10 font-size: 12px; 10 font-size: 12px;
11 padding: 0 10px; 11 padding: 0 10px;
12 12
@@ -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 }