作者 lyh

gx

@@ -66,12 +66,15 @@ class BlogCategoryLogic extends BaseLogic @@ -66,12 +66,15 @@ 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(111, 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(2222, true) . PHP_EOL, FILE_APPEND);
72 if($blogCount > 0){ 74 if($blogCount > 0){
73 //随机获取最后一级id 75 //随机获取最后一级id
74 $replacement = $this->getLastId($id); 76 $replacement = $this->getLastId($id);
  77 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export(333, true) . PHP_EOL, FILE_APPEND);
75 //存在博客时,移动所有博客到当前分类最后一级 78 //存在博客时,移动所有博客到当前分类最后一级
76 $blogModel->where('category_id', 'like', '%,' . $pid . ',%')->where('category_id', 'like', '%,' . $replacement . ',%') 79 $blogModel->where('category_id', 'like', '%,' . $pid . ',%')->where('category_id', 'like', '%,' . $replacement . ',%')
77 ->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',')")]); 80 ->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',')")]);