作者 lyh

gx

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