From 41ff69e0d9eefde1c0dcff1bd37b2570da0f4ecd Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Fri, 14 Jun 2024 18:16:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B92=E7=BA=A7=E5=92=8C1=E7=BA=A7?= =?UTF-8?q?=E5=88=AB=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/product/ProductLists.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php index 5cf03daad..4abfe93cb 100644 --- a/app/api/lists/product/ProductLists.php +++ b/app/api/lists/product/ProductLists.php @@ -94,12 +94,17 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li $class_all=$this->request->get('class_all'); $where=[]; if($class_all){ + //查3级别的 $arr=Cate::where('pid',$class_all)->column('id'); if($arr){ $arr2=Cate::where('pid','in',$arr)->column('id'); $where[]=['cate_id','in',array_merge($arr,$arr2)]; } } + if(empty($where)){ + //2或者1 + $where[]=['cate_id','=',$class_all]; + } $this->searchWhere[]=['status','=',1]; @@ -172,6 +177,10 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li $where[]=['cate_id','in',array_merge($arr,$arr2)]; } } + if(empty($where)){ + //2或者1 + $where[]=['cate_id','=',$class_all]; + } $M_store_id=$this->request->__get('store_id'); $this->searchWhere[]=['status','=',1]; $this->searchWhere[]=['stock','>',0];