正在显示
2 个修改的文件
包含
18 行增加
和
1 行删除
| @@ -105,7 +105,15 @@ class BlogCategoryLogic extends BaseLogic | @@ -105,7 +105,15 @@ class BlogCategoryLogic extends BaseLogic | ||
| 105 | if($info !== false){ | 105 | if($info !== false){ |
| 106 | $this->fail('当前分类名称已存在'); | 106 | $this->fail('当前分类名称已存在'); |
| 107 | } | 107 | } |
| 108 | - | 108 | + $info = $this->model->read(['id'=>$this->param['id']]); |
| 109 | + if($info['pid'] != $this->param['pid']){ | ||
| 110 | + //查询当前分类下是否有商品 | ||
| 111 | + $blogModel = new BlogModel(); | ||
| 112 | + $info = $blogModel->read(['id'=>['like','%,'.$this->param['id'].',%']]); | ||
| 113 | + if($info !== false){ | ||
| 114 | + $this->fail('当前分类下已存在博客,不允许修改上级'); | ||
| 115 | + } | ||
| 116 | + } | ||
| 109 | $this->param['operator_id'] = $this->user['id']; | 117 | $this->param['operator_id'] = $this->user['id']; |
| 110 | $this->edit($this->param,['id'=>$this->param['id']]); | 118 | $this->edit($this->param,['id'=>$this->param['id']]); |
| 111 | RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_BLOG_CATE, $this->param['id'], $this->user['project_id']); | 119 | RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_BLOG_CATE, $this->param['id'], $this->user['project_id']); |
| @@ -113,6 +113,15 @@ class NewsCategoryLogic extends BaseLogic | @@ -113,6 +113,15 @@ class NewsCategoryLogic extends BaseLogic | ||
| 113 | if($info !== false){ | 113 | if($info !== false){ |
| 114 | $this->fail('当前分类名称已存在'); | 114 | $this->fail('当前分类名称已存在'); |
| 115 | } | 115 | } |
| 116 | + $info = $this->model->read(['id'=>$this->param['id']]); | ||
| 117 | + if($info['pid'] != $this->param['pid']){ | ||
| 118 | + //查询当前分类下是否有商品 | ||
| 119 | + $newsModel = new NewsModel(); | ||
| 120 | + $info = $newsModel->read(['id'=>['like','%,'.$this->param['id'].',%']]); | ||
| 121 | + if($info !== false){ | ||
| 122 | + $this->fail('当前分类下已存在新闻,不允许修改上级'); | ||
| 123 | + } | ||
| 124 | + } | ||
| 116 | $this->param['operator_id'] = $this->user['id']; | 125 | $this->param['operator_id'] = $this->user['id']; |
| 117 | $this->edit($this->param,['id'=>$this->param['id']]); | 126 | $this->edit($this->param,['id'=>$this->param['id']]); |
| 118 | RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $this->param['id'], $this->user['project_id']); | 127 | RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $this->param['id'], $this->user['project_id']); |
-
请 注册 或 登录 后发表评论