From 66ae6469302c6d2bfcb3acacf0fdfdedbec28b5a Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Sun, 11 Aug 2024 10:12:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=93=81=E6=8E=A8=E8=8D=90=EF=BC=9A?= =?UTF-8?q?=E5=A6=82=E8=BF=87=E5=95=86=E5=AE=B6=E8=90=A5=E4=B8=9A=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=B8=8D=E7=AC=A6=E5=90=88=E5=88=99=E5=95=86=E5=93=81?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/GoodsLogic.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/api/logic/GoodsLogic.php b/app/api/logic/GoodsLogic.php index 5c5faf50..5469ab43 100755 --- a/app/api/logic/GoodsLogic.php +++ b/app/api/logic/GoodsLogic.php @@ -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()