作者 lyh

gx

@@ -66,11 +66,16 @@ class BlogCategoryLogic extends BaseLogic @@ -66,11 +66,16 @@ class BlogCategoryLogic extends BaseLogic
66 public function editHandleCategory($id,$pid){ 66 public function editHandleCategory($id,$pid){
67 $info = $this->model->read(['id'=>$id],['id','pid']); 67 $info = $this->model->read(['id'=>$id],['id','pid']);
68 if($info['pid'] != $pid){ 68 if($info['pid'] != $pid){
  69 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export(1111111, true) . PHP_EOL, FILE_APPEND);
69 //修改勒上级,先查看上级是否拥有博客 70 //修改勒上级,先查看上级是否拥有博客
70 $blogModel = new BlogModel(); 71 $blogModel = new BlogModel();
71 $blogCount = $blogModel->formatQuery(['category_id'=>['like','%,'.$pid.',%']])->count(); 72 $blogCount = $blogModel->formatQuery(['category_id'=>['like','%,'.$pid.',%']])->count();
  73 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export(222222, true) . PHP_EOL, FILE_APPEND);
  74 +
72 //随机获取最后一级id 75 //随机获取最后一级id
73 $replacement = $this->getLastId($id); 76 $replacement = $this->getLastId($id);
  77 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export(33333, true) . PHP_EOL, FILE_APPEND);
  78 +
74 if($blogCount > 0){ 79 if($blogCount > 0){
75 //存在博客时,移动所有博客到当前分类最后一级 80 //存在博客时,移动所有博客到当前分类最后一级
76 $blogModel->where('category_id', 'like', '%,' . $pid . ',%')->where('category_id', 'like', '%,' . $replacement . ',%') 81 $blogModel->where('category_id', 'like', '%,' . $pid . ',%')->where('category_id', 'like', '%,' . $replacement . ',%')
@@ -78,6 +83,8 @@ class BlogCategoryLogic extends BaseLogic @@ -78,6 +83,8 @@ class BlogCategoryLogic extends BaseLogic
78 $blogModel->where('category_id', 'like', '%,' . $pid . ',%') 83 $blogModel->where('category_id', 'like', '%,' . $pid . ',%')
79 ->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',$replacement,')")]); 84 ->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',$replacement,')")]);
80 } 85 }
  86 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export(44444, true) . PHP_EOL, FILE_APPEND);
  87 +
81 } 88 }
82 return $this->success(); 89 return $this->success();
83 } 90 }