作者 lyh

gx

... ... @@ -31,6 +31,7 @@ class BlogCategoryLogic extends BaseLogic
if(isset($this->param['id']) && !empty($this->param['id'])){
//排序掉当前id下所有子集
$str = $this->getAllSub($this->param['id'],$str);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($str, true) . PHP_EOL, FILE_APPEND);
$this->param['id'] = ['!=',$str];
}
$list = $this->model->list($this->param);
... ... @@ -51,13 +52,13 @@ class BlogCategoryLogic extends BaseLogic
* @time :2023/10/18 15:10
*/
public function getAllSub($id,&$str = []){
$str[] = $id;
$list = $this->model->list(['pid'=>$id,'status'=>0],['id','pid']);
if(!empty($list)){
foreach ($list as $v){
$str[] = $v['id'];
$this->getAllSub($v['id'],$str);
}
$str[] = $id;
}
return $this->success($str);
}
... ...