From 3976af97f1a177b5a3dc7fdc5f3ec5e87280d076 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 18 Apr 2025 13:47:42 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E4=BB=93=E5=BA=93=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加了根据分类 ID 进行搜索的功能 - 如果请求中包含 'class_all' 参数,则在查询中加入相应的条件 - 通过 StoreProduct 模型获取符合条件的产品 ID 列表 - 如果没有符合条件的产品,则返回空数组 --- .../WarehouseProductStoregeLists.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/admin/lists/warehouse_product_storege/WarehouseProductStoregeLists.php b/app/admin/lists/warehouse_product_storege/WarehouseProductStoregeLists.php index e7f2c6932..ef9841873 100644 --- a/app/admin/lists/warehouse_product_storege/WarehouseProductStoregeLists.php +++ b/app/admin/lists/warehouse_product_storege/WarehouseProductStoregeLists.php @@ -88,6 +88,16 @@ class WarehouseProductStoregeLists extends BaseAdminDataLists implements ListsSe return []; } } + if($this->request->get('class_all')){ + $where[] = ['top_cate_id', 'in', $this->request->get('class_all')]; + } + $ids = StoreProduct::where($where)->column('id'); + if ($ids) { + $this->searchWhere[] = ['product_id', 'in', $ids]; + $this->ids = $ids; + } else { + return []; + } return WarehouseProductStorege::where($this->searchWhere) ->field(['id','is_verify','warehouse_id', 'product_id', 'nums', 'price', 'total_price', 'status']) ->limit($this->limitOffset, $this->limitLength)