更改热销榜单获取商品数量
This commit is contained in:
parent
05a8639308
commit
d78c62620f
@ -263,7 +263,6 @@ class IndexLogic extends Logic
|
||||
// 热销榜单
|
||||
$hot_list = self::getIndexHotList();
|
||||
|
||||
|
||||
return [
|
||||
'headlines' => $headlines,
|
||||
'hots' => $hots,
|
||||
@ -1085,30 +1084,30 @@ class IndexLogic extends Logic
|
||||
|
||||
$count = count($hot_list);
|
||||
|
||||
if ($count < 6) {
|
||||
$where[] = ['og.create_time', '>=', strtotime("today")];
|
||||
$where[] = ['og.create_time', '<=', strtotime("tomorrow") - 1];
|
||||
|
||||
$shopWhere = [];
|
||||
if (!empty(GoodsLogic::filterShopsIds())) {
|
||||
// 过滤已删除、已冻结、已暂停营业、已到期的店铺
|
||||
$shopWhere[] = ['og.shop_id', 'not in', GoodsLogic::filterShopsIds()];
|
||||
}
|
||||
|
||||
$order_goods = Db::name('order_goods')
|
||||
->alias('og')
|
||||
->join('goods g', 'og.goods_id = g.id')
|
||||
->field('og.goods_id, og.create_time, count(*) as count, g.id as gid, g.name, g.image, g.issuing_price, g.market_price, g.min_price, g.purchase_price, g.wholesale_price')
|
||||
->group('og.goods_id')
|
||||
->where($shopWhere)
|
||||
->where($onSaleWhere)
|
||||
->limit(6 - $count)
|
||||
->order('og.create_time desc, count desc')
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
$result = array_merge($hot_list, $order_goods);
|
||||
foreach ($result as &$v) {
|
||||
// if ($count < 6) {
|
||||
// $where[] = ['og.create_time', '>=', strtotime("today")];
|
||||
// $where[] = ['og.create_time', '<=', strtotime("tomorrow") - 1];
|
||||
//
|
||||
// $shopWhere = [];
|
||||
// if (!empty(GoodsLogic::filterShopsIds())) {
|
||||
// // 过滤已删除、已冻结、已暂停营业、已到期的店铺
|
||||
// $shopWhere[] = ['og.shop_id', 'not in', GoodsLogic::filterShopsIds()];
|
||||
// }
|
||||
//
|
||||
// $order_goods = Db::name('order_goods')
|
||||
// ->alias('og')
|
||||
// ->join('goods g', 'og.goods_id = g.id')
|
||||
// ->field('og.goods_id, og.create_time, count(*) as count, g.id as gid, g.name, g.image, g.issuing_price, g.market_price, g.min_price, g.purchase_price, g.wholesale_price')
|
||||
// ->group('og.goods_id')
|
||||
// ->where($shopWhere)
|
||||
// ->where($onSaleWhere)
|
||||
// ->limit(6 - $count)
|
||||
// ->order('og.create_time desc, count desc')
|
||||
// ->select()
|
||||
// ->toArray();
|
||||
// }
|
||||
// $result = array_merge($hot_list, $order_goods);
|
||||
foreach ($hot_list as &$v) {
|
||||
$v['market_price'] = round($v['min_price'],2);
|
||||
$v['min_price'] = round(0.88*$v['min_price'],2);
|
||||
if (isset($v['image'])) {
|
||||
@ -1116,6 +1115,6 @@ class IndexLogic extends Logic
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
return $hot_list;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user