兼容2级和1级别查询
This commit is contained in:
parent
305707d179
commit
41ff69e0d9
@ -94,12 +94,17 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li
|
|||||||
$class_all=$this->request->get('class_all');
|
$class_all=$this->request->get('class_all');
|
||||||
$where=[];
|
$where=[];
|
||||||
if($class_all){
|
if($class_all){
|
||||||
|
//查3级别的
|
||||||
$arr=Cate::where('pid',$class_all)->column('id');
|
$arr=Cate::where('pid',$class_all)->column('id');
|
||||||
if($arr){
|
if($arr){
|
||||||
$arr2=Cate::where('pid','in',$arr)->column('id');
|
$arr2=Cate::where('pid','in',$arr)->column('id');
|
||||||
$where[]=['cate_id','in',array_merge($arr,$arr2)];
|
$where[]=['cate_id','in',array_merge($arr,$arr2)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(empty($where)){
|
||||||
|
//2或者1
|
||||||
|
$where[]=['cate_id','=',$class_all];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->searchWhere[]=['status','=',1];
|
$this->searchWhere[]=['status','=',1];
|
||||||
@ -172,6 +177,10 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li
|
|||||||
$where[]=['cate_id','in',array_merge($arr,$arr2)];
|
$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');
|
$M_store_id=$this->request->__get('store_id');
|
||||||
$this->searchWhere[]=['status','=',1];
|
$this->searchWhere[]=['status','=',1];
|
||||||
$this->searchWhere[]=['stock','>',0];
|
$this->searchWhere[]=['stock','>',0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user