热销榜单商品的商家如果是非营业状态,则数据也不显示
This commit is contained in:
parent
563059cf35
commit
e9fd94c921
@ -917,6 +917,12 @@ class GoodsLogic extends Logic
|
||||
}
|
||||
}
|
||||
|
||||
$shopWhere = [];
|
||||
if (!empty(self::filterShopsIds())) {
|
||||
// 过滤已删除、已冻结、已暂停营业、已到期的店铺
|
||||
$shopWhere[] = ['og.shop_id', 'not in', self::filterShopsIds()];
|
||||
}
|
||||
|
||||
$onSaleWhere = [
|
||||
'del' => GoodsEnum::DEL_NORMAL, // 未删除
|
||||
'status' => GoodsEnum::STATUS_SHELVES, // 上架中
|
||||
@ -927,6 +933,7 @@ class GoodsLogic extends Logic
|
||||
->alias('og')
|
||||
->join('goods g', 'og.goods_id = g.id')
|
||||
->where($onSaleWhere)
|
||||
->where($shopWhere)
|
||||
->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')
|
||||
->order('og.create_time desc, count desc')
|
||||
|
||||
@ -1021,11 +1021,19 @@ class IndexLogic extends Logic
|
||||
$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()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user