正在显示
1 个修改的文件
包含
3 行增加
和
2 行删除
| @@ -33,6 +33,7 @@ class BlogCategoryLogic extends BaseLogic | @@ -33,6 +33,7 @@ class BlogCategoryLogic extends BaseLogic | ||
| 33 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 33 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 34 | //查看路由是否更新 | 34 | //查看路由是否更新 |
| 35 | $id = $this->editCategoryRoute($this->param['id'], $this->param['alias']); | 35 | $id = $this->editCategoryRoute($this->param['id'], $this->param['alias']); |
| 36 | + $this->editHandleCategory($this->param['id'],$this->param['pid']); | ||
| 36 | $this->param['operator_id'] = $this->user['id']; | 37 | $this->param['operator_id'] = $this->user['id']; |
| 37 | $this->edit($this->param,['id'=>$this->param['id']]); | 38 | $this->edit($this->param,['id'=>$this->param['id']]); |
| 38 | }else{ | 39 | }else{ |
| @@ -67,10 +68,10 @@ class BlogCategoryLogic extends BaseLogic | @@ -67,10 +68,10 @@ class BlogCategoryLogic extends BaseLogic | ||
| 67 | if($info['pid'] != $pid){ | 68 | if($info['pid'] != $pid){ |
| 68 | //修改勒上级,先查看上级是否拥有博客 | 69 | //修改勒上级,先查看上级是否拥有博客 |
| 69 | $blogModel = new BlogModel(); | 70 | $blogModel = new BlogModel(); |
| 70 | - $blogList = $blogModel->list(['category_id'=>['like','%,'.$pid.',%']],['id']); | 71 | + $blogCount = $blogModel->formatQuery(['category_id'=>['like','%,'.$pid.',%']])->count(); |
| 71 | //随机获取最后一级id | 72 | //随机获取最后一级id |
| 72 | $replacement = $this->getLastId($id); | 73 | $replacement = $this->getLastId($id); |
| 73 | - if(!empty($blogList)){ | 74 | + if($blogCount > 0){ |
| 74 | //存在博客时,移动所有博客到当前分类最后一级 | 75 | //存在博客时,移动所有博客到当前分类最后一级 |
| 75 | $blogModel->where('category_id', 'like', '%,' . $pid . ',%') | 76 | $blogModel->where('category_id', 'like', '%,' . $pid . ',%') |
| 76 | ->update(['category_id' => DB::raw("REPLACE(category_id, '$pid', '$replacement')")]); | 77 | ->update(['category_id' => DB::raw("REPLACE(category_id, '$pid', '$replacement')")]); |
-
请 注册 或 登录 后发表评论