新品推荐:如过商家营业状态不符合则商品不显示
This commit is contained in:
parent
96bbb47f6b
commit
66ae646930
@ -964,8 +964,14 @@ class GoodsLogic extends Logic
|
||||
}
|
||||
|
||||
public static function goodsList($type, $page, $size) {
|
||||
$where[] = ['create_time', '>=', strtotime("today")];
|
||||
$where[] = ['create_time', '<=', strtotime("tomorrow") - 1];
|
||||
// $where[] = ['create_time', '>=', strtotime("today")];
|
||||
// $where[] = ['create_time', '<=', strtotime("tomorrow") - 1];
|
||||
|
||||
$shopWhere = [];
|
||||
if (!empty(self::filterShopsIds())) {
|
||||
// 过滤已删除、已冻结、已暂停营业、已到期的店铺
|
||||
$shopWhere[] = ['shop_id', 'not in', self::filterShopsIds()];
|
||||
}
|
||||
|
||||
$onSaleWhere = [
|
||||
'del' => GoodsEnum::DEL_NORMAL, // 未删除
|
||||
@ -980,6 +986,7 @@ class GoodsLogic extends Logic
|
||||
->alias('ng')
|
||||
->join('goods g', 'ng.goods_id = g.id')
|
||||
->where($onSaleWhere)
|
||||
->where($shopWhere)
|
||||
->where('delete_time', 0)
|
||||
->field('ng.id as ng_id, g.id as id, g.name, g.image, g.issuing_price, g.market_price, g.min_price, g.purchase_price, g.wholesale_price')
|
||||
->limit(4)
|
||||
@ -991,6 +998,7 @@ class GoodsLogic extends Logic
|
||||
if ($count < 4) {
|
||||
$goods = Db::name('goods')
|
||||
->where($onSaleWhere)
|
||||
->where($shopWhere)
|
||||
->limit(4 - $count)
|
||||
->order('create_time desc')
|
||||
->select()
|
||||
@ -1008,6 +1016,7 @@ class GoodsLogic extends Logic
|
||||
$list = Db::name('new_goods')
|
||||
->alias('ng')
|
||||
->join('goods g', 'ng.goods_id = g.id')
|
||||
->where($shopWhere)
|
||||
->where($onSaleWhere)
|
||||
->where('delete_time', 0)
|
||||
->field('ng.id as ng_id, g.id as id, g.name, g.image, g.issuing_price, g.market_price, g.min_price, g.purchase_price, g.wholesale_price')
|
||||
@ -1016,6 +1025,7 @@ class GoodsLogic extends Logic
|
||||
|
||||
$goods = Db::name('goods')
|
||||
->where($onSaleWhere)
|
||||
->where($shopWhere)
|
||||
->order('create_time desc')
|
||||
->page($page, $size)
|
||||
->select()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user