Authored by 周少峰

调整返回前台的数据结构

@@ -123,15 +123,31 @@ class HelperSearch @@ -123,15 +123,31 @@ class HelperSearch
123 'pageCount' => $result['page_total'], 123 'pageCount' => $result['page_total'],
124 'nextHref' => $result['filter']['next'] 124 'nextHref' => $result['filter']['next']
125 ), 125 ),
  126 + 'hasNextPage' => array(
  127 + 'href' => $result['filter']['next'],
  128 + 'src' => 'http://img10.static.yhbimg.com/product/2014/01/15/11/01fa01614784f6239760f1b749663016f1.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90'
  129 + ),
126 'goods' => $result['product_list'], 130 'goods' => $result['product_list'],
  131 + 'leftContent' => array(
  132 + array(
127 'allSort' => array( 133 'allSort' => array(
128 //'updateNum' => $result['filter']['group_sort']['all']['num'], 134 //'updateNum' => $result['filter']['group_sort']['all']['num'],
129 'list' => $result['filter']['group_sort']['list'] 135 'list' => $result['filter']['group_sort']['list']
  136 + )
  137 + ),
  138 + array(
  139 + 'advNav' => array()
  140 + ),
  141 + array(
  142 + 'advPic' => array()
  143 + ),
  144 + array(
  145 + 'newSales' => $result['filter']['recent']
  146 + ),
  147 + array('allDiscount' => $result['filter']['discount'])
130 ), 148 ),
131 - 'advNav' => array(),  
132 - 'advPic' => array(),  
133 - 'newSales' => $result['filter']['recent'],  
134 - 'allDiscount' => $result['filter']['discount'] 149 + 'totalCount' => $result['total'],
  150 +
135 ); 151 );
136 return $data; 152 return $data;
137 } 153 }
@@ -150,8 +166,6 @@ class HelperSearch @@ -150,8 +166,6 @@ class HelperSearch
150 $isLimit = isset($val['is_limited']) && $val['is_limited'] === 'Y'; 166 $isLimit = isset($val['is_limited']) && $val['is_limited'] === 'Y';
151 //即将售罄 167 //即将售罄
152 $isFew = $val['is_soon_sold_out'] === 'Y' ? true : false; 168 $isFew = $val['is_soon_sold_out'] === 'Y' ? true : false;
153 - $is_promotion = $val['is_promotion'];  
154 -  
155 //SALE 169 //SALE
156 //新品节 170 //新品节
157 //再到着 171 //再到着
@@ -167,8 +181,7 @@ class HelperSearch @@ -167,8 +181,7 @@ class HelperSearch
167 $result[] = array( 181 $result[] = array(
168 'tags' => array( 182 'tags' => array(
169 'isNew' => $isNew, 183 'isNew' => $isNew,
170 - 'isLimit' => $isLimit,  
171 - 'isYearEndPromotion' => $is_promotion 184 + 'isLimit' => $isLimit
172 ), 185 ),
173 'url' => $goods_list[0]['url'], 186 'url' => $goods_list[0]['url'],
174 'thumb' => $val['default_images'], 187 'thumb' => $val['default_images'],
@@ -1104,7 +1117,7 @@ class HelperSearch @@ -1104,7 +1117,7 @@ class HelperSearch
1104 if (empty($list)) { 1117 if (empty($list)) {
1105 return array(); 1118 return array();
1106 } 1119 }
1107 - $params = $_GET; 1120 + $params = self::$params;
1108 $query = array(); 1121 $query = array();
1109 if (isset($params['gender'])) { 1122 if (isset($params['gender'])) {
1110 $query['gender'] = $params['gender']; 1123 $query['gender'] = $params['gender'];
@@ -1116,16 +1129,16 @@ class HelperSearch @@ -1116,16 +1129,16 @@ class HelperSearch
1116 $query['misort'] = $params['misort']; 1129 $query['misort'] = $params['misort'];
1117 } 1130 }
1118 $data = array(); 1131 $data = array();
1119 - $total = 0;  
1120 $i = 0; 1132 $i = 0;
1121 foreach ($list as $k => $v) { 1133 foreach ($list as $k => $v) {
1122 - $total+= $v;  
1123 $star_time = strtotime($k); 1134 $star_time = strtotime($k);
1124 $end_time = $star_time+60*60*24; 1135 $end_time = $star_time+60*60*24;
1125 $query['shelve_time'] = ''; 1136 $query['shelve_time'] = '';
1126 $query['shelve_time'] = $star_time.','.$end_time; 1137 $query['shelve_time'] = $star_time.','.$end_time;
  1138 + if (isset($params['shelve_time']) && $query['shelve_time'] == $params['shelve_time']) {
  1139 + $data[$i]['active'] = true;
  1140 + }
1127 @$data[$i]['href'] = self::buildurl($query); 1141 @$data[$i]['href'] = self::buildurl($query);
1128 - //$data[$i]['num'] = $v;  
1129 $data[$i]['name'] = $k; 1142 $data[$i]['name'] = $k;
1130 $i++; 1143 $i++;
1131 } 1144 }
@@ -81,6 +81,7 @@ class ListController extends WebAction @@ -81,6 +81,7 @@ class ListController extends WebAction
81 $params = $condition + $_GET; 81 $params = $condition + $_GET;
82 $params = array_filter($params); 82 $params = array_filter($params);
83 $data = SearchModel::getSearchData($params,$options); 83 $data = SearchModel::getSearchData($params,$options);
  84 +// print_r($data); exit;
84 $cate = array('boys','girls','kids','lifestyle'); 85 $cate = array('boys','girls','kids','lifestyle');
85 $this->setWebNavHeader($cate[$gender-1]); 86 $this->setWebNavHeader($cate[$gender-1]);
86 $this->_view->display('list', $data); 87 $this->_view->display('list', $data);