Authored by whb

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

... ... @@ -104,7 +104,6 @@ class HotrankModel
$sort = $info['data']['category_id'];
}
}
//一周热卖
$config = array(
'sort' => $sort,
'gender' => $data['gender'],
... ... @@ -114,7 +113,7 @@ class HotrankModel
$lister = $list['hotWeek']['list'];
$lister = array_values($lister);
if ($sid == 1 && $page == 1) {
$lister = array_slice($lister, 10, 50);
$lister = array_slice($lister, 10, 50); //排除十个“人气单品”的商品
}
else {
$lister = array_slice($lister, 0, 50);
... ... @@ -149,10 +148,9 @@ class HotrankModel
public static function getSearchData($config, $page, $ajax)
{
//配置查询商品参数
$viewNum = 60;
$param = array(
'order' => 's_n_desc',
'viewNum' => $viewNum,
'viewNum' => 60,
'page' => $page,
'stocknumber' => 1,
'status' => 1,
... ... @@ -206,17 +204,23 @@ class HotrankModel
public static function getProductList($result, $page, $ajax = 0)
{
$product = array();
if (isset($result) && isset($result['data']) && isset($result['data']['product_list'])) {
$data = array(
'popular' => array(
'name' => '人气单品',
'list' => array(),
),
'hotWeek' => array(
'name' => '一周热卖',
'list' => array(),
)
);
$url = Helpers::url('/product/pro', '', 'item');
if (empty($result) || empty($result['data']) || empty($result['data']['product_list'])) {
return $product;
}
$data = $result['data']['product_list'];
$popular = array(); //一周热卖
$hotWeek = array(); //人气单品
foreach ($data as $key => $val) {
foreach ($result['data']['product_list'] as $key => $val) {
if (empty($val['goods_list'])) {
continue;
}
//配置商品图片超链接路径
$defaultGoodsId = 0;
foreach ($val['goods_list'] as $v) {
if ($v['is_default'] == 'Y') {
... ... @@ -234,12 +238,12 @@ class HotrankModel
if ($key <= 5) {
//6张大图
$product['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 378, 504, 2);
$popular['list'][] = $product;
$data['popular']['list'][] = $product;
}
else {
//4张小图
$product['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
$popular['list'][] = $product;
$data['popular']['list'][] = $product;
}
}
else {
... ... @@ -248,18 +252,11 @@ class HotrankModel
$product['url'] = $url . '_' . $product_id . '_' . $defaultGoodsId . '.html';
$product['marketPrice'] = (int) $val['market_price'] == (int) $val['sales_price'] ? false : $val['market_price'];
$product['salePrice'] = empty($val['sales_price']) ? false : $val['sales_price'];
$product['rank'] = '';
$product['thumb'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
$hot[] = $product;
$data['hotWeek']['list'][] = $product;
}
}
}
$popular['name'] = '人气单品';
$hotWeek = array(
'name' => '一周热卖',
'list' => $hot,
);
$data['popular'] = $popular;
$data['hotWeek'] = $hotWeek;
return $data;
}
... ...