作者 lyh

gx

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