Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
1 changed file
with
49 additions
and
52 deletions
@@ -104,7 +104,6 @@ class HotrankModel | @@ -104,7 +104,6 @@ class HotrankModel | ||
104 | $sort = $info['data']['category_id']; | 104 | $sort = $info['data']['category_id']; |
105 | } | 105 | } |
106 | } | 106 | } |
107 | - //一周热卖 | ||
108 | $config = array( | 107 | $config = array( |
109 | 'sort' => $sort, | 108 | 'sort' => $sort, |
110 | 'gender' => $data['gender'], | 109 | 'gender' => $data['gender'], |
@@ -114,7 +113,7 @@ class HotrankModel | @@ -114,7 +113,7 @@ class HotrankModel | ||
114 | $lister = $list['hotWeek']['list']; | 113 | $lister = $list['hotWeek']['list']; |
115 | $lister = array_values($lister); | 114 | $lister = array_values($lister); |
116 | if ($sid == 1 && $page == 1) { | 115 | if ($sid == 1 && $page == 1) { |
117 | - $lister = array_slice($lister, 10, 50); | 116 | + $lister = array_slice($lister, 10, 50); //排除十个“人气单品”的商品 |
118 | } | 117 | } |
119 | else { | 118 | else { |
120 | $lister = array_slice($lister, 0, 50); | 119 | $lister = array_slice($lister, 0, 50); |
@@ -149,10 +148,9 @@ class HotrankModel | @@ -149,10 +148,9 @@ class HotrankModel | ||
149 | public static function getSearchData($config, $page, $ajax) | 148 | public static function getSearchData($config, $page, $ajax) |
150 | { | 149 | { |
151 | //配置查询商品参数 | 150 | //配置查询商品参数 |
152 | - $viewNum = 60; | ||
153 | $param = array( | 151 | $param = array( |
154 | 'order' => 's_n_desc', | 152 | 'order' => 's_n_desc', |
155 | - 'viewNum' => $viewNum, | 153 | + 'viewNum' => 60, |
156 | 'page' => $page, | 154 | 'page' => $page, |
157 | 'stocknumber' => 1, | 155 | 'stocknumber' => 1, |
158 | 'status' => 1, | 156 | 'status' => 1, |
@@ -206,60 +204,59 @@ class HotrankModel | @@ -206,60 +204,59 @@ class HotrankModel | ||
206 | public static function getProductList($result, $page, $ajax = 0) | 204 | public static function getProductList($result, $page, $ajax = 0) |
207 | { | 205 | { |
208 | $product = array(); | 206 | $product = array(); |
209 | - $url = Helpers::url('/product/pro', '', 'item'); | ||
210 | - if (empty($result) || empty($result['data']) || empty($result['data']['product_list'])) { | ||
211 | - return $product; | ||
212 | - } | ||
213 | - $data = $result['data']['product_list']; | ||
214 | - $popular = array(); //一周热卖 | ||
215 | - $hotWeek = array(); //人气单品 | ||
216 | - foreach ($data as $key => $val) { | ||
217 | - if (empty($val['goods_list'])) { | ||
218 | - continue; | ||
219 | - } | ||
220 | - $defaultGoodsId = 0; | ||
221 | - foreach ($val['goods_list'] as $v) { | ||
222 | - if ($v['is_default'] == 'Y') { | ||
223 | - $defaultGoodsId = empty($v['goods_id']) ? $val['goods_list'][0]['goods_id'] : $v['goods_id']; | 207 | + if (isset($result) && isset($result['data']) && isset($result['data']['product_list'])) { |
208 | + $data = array( | ||
209 | + 'popular' => array( | ||
210 | + 'name' => '人气单品', | ||
211 | + 'list' => array(), | ||
212 | + ), | ||
213 | + 'hotWeek' => array( | ||
214 | + 'name' => '一周热卖', | ||
215 | + 'list' => array(), | ||
216 | + ) | ||
217 | + ); | ||
218 | + $url = Helpers::url('/product/pro', '', 'item'); | ||
219 | + foreach ($result['data']['product_list'] as $key => $val) { | ||
220 | + if (empty($val['goods_list'])) { | ||
221 | + continue; | ||
224 | } | 222 | } |
225 | - } | ||
226 | - $product_id = empty($val['product_id']) ? '' : $val['product_id']; | ||
227 | - if ($key <= 9 && $page == 1 && $ajax == 0) { | ||
228 | - //人气单品 | ||
229 | - $product['rank'] = $key + 1; | ||
230 | - $product['title'] = $val['product_name']; | ||
231 | - $product['href'] = $url . '_' . $product_id . '_' . $defaultGoodsId . '.html'; | ||
232 | - $product['price'] = (int) $val['market_price'] == (int) $val['sales_price'] ? false : $val['market_price']; | ||
233 | - $product['sPrice'] = empty($val['sales_price']) ? false : $val['sales_price']; | ||
234 | - if ($key <= 5) { | ||
235 | - //6张大图 | ||
236 | - $product['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 378, 504, 2); | ||
237 | - $popular['list'][] = $product; | 223 | + //配置商品图片超链接路径 |
224 | + $defaultGoodsId = 0; | ||
225 | + foreach ($val['goods_list'] as $v) { | ||
226 | + if ($v['is_default'] == 'Y') { | ||
227 | + $defaultGoodsId = empty($v['goods_id']) ? $val['goods_list'][0]['goods_id'] : $v['goods_id']; | ||
228 | + } | ||
229 | + } | ||
230 | + $product_id = empty($val['product_id']) ? '' : $val['product_id']; | ||
231 | + if ($key <= 9 && $page == 1 && $ajax == 0) { | ||
232 | + //人气单品 | ||
233 | + $product['rank'] = $key + 1; | ||
234 | + $product['title'] = $val['product_name']; | ||
235 | + $product['href'] = $url . '_' . $product_id . '_' . $defaultGoodsId . '.html'; | ||
236 | + $product['price'] = (int) $val['market_price'] == (int) $val['sales_price'] ? false : $val['market_price']; | ||
237 | + $product['sPrice'] = empty($val['sales_price']) ? false : $val['sales_price']; | ||
238 | + if ($key <= 5) { | ||
239 | + //6张大图 | ||
240 | + $product['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 378, 504, 2); | ||
241 | + $data['popular']['list'][] = $product; | ||
242 | + } | ||
243 | + else { | ||
244 | + //4张小图 | ||
245 | + $product['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2); | ||
246 | + $data['popular']['list'][] = $product; | ||
247 | + } | ||
238 | } | 248 | } |
239 | else { | 249 | else { |
240 | - //4张小图 | ||
241 | - $product['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2); | ||
242 | - $popular['list'][] = $product; | 250 | + //一周热卖 |
251 | + $product['name'] = $val['product_name']; | ||
252 | + $product['url'] = $url . '_' . $product_id . '_' . $defaultGoodsId . '.html'; | ||
253 | + $product['marketPrice'] = (int) $val['market_price'] == (int) $val['sales_price'] ? false : $val['market_price']; | ||
254 | + $product['salePrice'] = empty($val['sales_price']) ? false : $val['sales_price']; | ||
255 | + $product['thumb'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2); | ||
256 | + $data['hotWeek']['list'][] = $product; | ||
243 | } | 257 | } |
244 | } | 258 | } |
245 | - else { | ||
246 | - //一周热卖 | ||
247 | - $product['name'] = $val['product_name']; | ||
248 | - $product['url'] = $url . '_' . $product_id . '_' . $defaultGoodsId . '.html'; | ||
249 | - $product['marketPrice'] = (int) $val['market_price'] == (int) $val['sales_price'] ? false : $val['market_price']; | ||
250 | - $product['salePrice'] = empty($val['sales_price']) ? false : $val['sales_price']; | ||
251 | - $product['rank'] = ''; | ||
252 | - $product['thumb'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2); | ||
253 | - $hot[] = $product; | ||
254 | - } | ||
255 | } | 259 | } |
256 | - $popular['name'] = '人气单品'; | ||
257 | - $hotWeek = array( | ||
258 | - 'name' => '一周热卖', | ||
259 | - 'list' => $hot, | ||
260 | - ); | ||
261 | - $data['popular'] = $popular; | ||
262 | - $data['hotWeek'] = $hotWeek; | ||
263 | return $data; | 260 | return $data; |
264 | } | 261 | } |
265 | 262 |
-
Please register or login to post a comment