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,60 +204,59 @@ class HotrankModel
public static function getProductList($result, $page, $ajax = 0)
{
$product = 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) {
if (empty($val['goods_list'])) {
continue;
}
$defaultGoodsId = 0;
foreach ($val['goods_list'] as $v) {
if ($v['is_default'] == 'Y') {
$defaultGoodsId = empty($v['goods_id']) ? $val['goods_list'][0]['goods_id'] : $v['goods_id'];
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');
foreach ($result['data']['product_list'] as $key => $val) {
if (empty($val['goods_list'])) {
continue;
}
}
$product_id = empty($val['product_id']) ? '' : $val['product_id'];
if ($key <= 9 && $page == 1 && $ajax == 0) {
//人气单品
$product['rank'] = $key + 1;
$product['title'] = $val['product_name'];
$product['href'] = $url . '_' . $product_id . '_' . $defaultGoodsId . '.html';
$product['price'] = (int) $val['market_price'] == (int) $val['sales_price'] ? false : $val['market_price'];
$product['sPrice'] = empty($val['sales_price']) ? false : $val['sales_price'];
if ($key <= 5) {
//6张大图
$product['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 378, 504, 2);
$popular['list'][] = $product;
//配置商品图片超链接路径
$defaultGoodsId = 0;
foreach ($val['goods_list'] as $v) {
if ($v['is_default'] == 'Y') {
$defaultGoodsId = empty($v['goods_id']) ? $val['goods_list'][0]['goods_id'] : $v['goods_id'];
}
}
$product_id = empty($val['product_id']) ? '' : $val['product_id'];
if ($key <= 9 && $page == 1 && $ajax == 0) {
//人气单品
$product['rank'] = $key + 1;
$product['title'] = $val['product_name'];
$product['href'] = $url . '_' . $product_id . '_' . $defaultGoodsId . '.html';
$product['price'] = (int) $val['market_price'] == (int) $val['sales_price'] ? false : $val['market_price'];
$product['sPrice'] = empty($val['sales_price']) ? false : $val['sales_price'];
if ($key <= 5) {
//6张大图
$product['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 378, 504, 2);
$data['popular']['list'][] = $product;
}
else {
//4张小图
$product['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
$data['popular']['list'][] = $product;
}
}
else {
//4张小图
$product['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
$popular['list'][] = $product;
//一周热卖
$product['name'] = $val['product_name'];
$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['thumb'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
$data['hotWeek']['list'][] = $product;
}
}
else {
//一周热卖
$product['name'] = $val['product_name'];
$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;
}
}
$popular['name'] = '人气单品';
$hotWeek = array(
'name' => '一周热卖',
'list' => $hot,
);
$data['popular'] = $popular;
$data['hotWeek'] = $hotWeek;
return $data;
}
... ...