正在显示
1 个修改的文件
包含
4 行增加
和
1 行删除
| @@ -72,9 +72,12 @@ class BlogCategoryLogic extends BaseLogic | @@ -72,9 +72,12 @@ class BlogCategoryLogic extends BaseLogic | ||
| 72 | //随机获取最后一级id | 72 | //随机获取最后一级id |
| 73 | $replacement = $this->getLastId($id); | 73 | $replacement = $this->getLastId($id); |
| 74 | if($blogCount > 0){ | 74 | if($blogCount > 0){ |
| 75 | + if($replacement == $pid){ | ||
| 76 | + $replacement = ','; | ||
| 77 | + } | ||
| 75 | //存在博客时,移动所有博客到当前分类最后一级 | 78 | //存在博客时,移动所有博客到当前分类最后一级 |
| 76 | $blogModel->where('category_id', 'like', '%,' . $pid . ',%') | 79 | $blogModel->where('category_id', 'like', '%,' . $pid . ',%') |
| 77 | - ->update(['category_id' => DB::raw("REPLACE(category_id, '$pid', '$replacement')")]); | 80 | + ->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', '$replacement')")]); |
| 78 | } | 81 | } |
| 79 | } | 82 | } |
| 80 | return $this->success(); | 83 | return $this->success(); |
-
请 注册 或 登录 后发表评论