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];