|
@@ -30,16 +30,20 @@ class Cate extends Base{
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
*/
|
|
|
public function list(){
|
|
|
- $param=$this->request->param(["pid"=>0,"cat_name"=>"","status"=>"","page"=>1,"size"=>10],"post","trim");
|
|
|
+ $param=$this->request->param(["pid"=>0,"cat_name"=>"","status"=>"","level"=>"","search"=>"","page"=>1,"size"=>10],"post","trim");
|
|
|
$where=[["is_del","=",0]];
|
|
|
if($param["pid"]!=="")$where[]=["pid","=",$param["pid"]];
|
|
|
if($param["cat_name"]!=="")$where[]=["cat_name","like","%".$param["cat_name"]."%"];
|
|
|
if($param["status"]!=="")$where[]=["status","=",$param["status"]];
|
|
|
+ if($param["level"]!=="")$where[]=["level","=",$param["level"]];
|
|
|
+ if($param["search"]!=="")$where[]=["search","like","%".$param["search"]."%"];
|
|
|
$data=$this->model->where($where)->order("id","desc")->paginate(['page'=>$param['page'],'list_rows'=>$param['size']])
|
|
|
->each(function(&$item){
|
|
|
$item["im"]=CatSpecs::with(["specs"])->where("cat_id",$item["id"])->field(["specs_id"])->select();
|
|
|
$depart = \app\user\model\AccountItem::with(["ItemName"])->where(["account_id"=>$item["createrid"]])->findOrEmpty();
|
|
|
$item["company_name"]=$depart->depart_name??"";
|
|
|
+ $search_arr= Cat::GetCatListByChildId($item['id']);
|
|
|
+ $item['item'] = array_column($search_arr,"id") ;
|
|
|
});
|
|
|
return success("获取成功",["list"=>$data->items(),"count"=>$data->total()]);
|
|
|
}
|