作者 lyh

gx

@@ -107,6 +107,9 @@ class BlogCategoryLogic extends BaseLogic @@ -107,6 +107,9 @@ class BlogCategoryLogic extends BaseLogic
107 $this->fail('当前分类名称已存在'); 107 $this->fail('当前分类名称已存在');
108 } 108 }
109 $info = $this->model->read(['id'=>$this->param['id']]); 109 $info = $this->model->read(['id'=>$this->param['id']]);
  110 + if($info['id'] == $this->param['pid']){
  111 + $this->fail('不能成为自己的上级');
  112 + }
110 if($info['pid'] != $this->param['pid']){ 113 if($info['pid'] != $this->param['pid']){
111 //查询当前分类下是否有商品 114 //查询当前分类下是否有商品
112 $blogModel = new BlogModel(); 115 $blogModel = new BlogModel();
@@ -15,7 +15,6 @@ class NewsCategoryLogic extends BaseLogic @@ -15,7 +15,6 @@ class NewsCategoryLogic extends BaseLogic
15 public function __construct() 15 public function __construct()
16 { 16 {
17 parent::__construct(); 17 parent::__construct();
18 -  
19 $this->model = new NewsCategoryModel(); 18 $this->model = new NewsCategoryModel();
20 $this->param = $this->requestAll; 19 $this->param = $this->requestAll;
21 } 20 }
@@ -117,6 +116,9 @@ class NewsCategoryLogic extends BaseLogic @@ -117,6 +116,9 @@ class NewsCategoryLogic extends BaseLogic
117 $this->fail('当前分类名称已存在'); 116 $this->fail('当前分类名称已存在');
118 } 117 }
119 $info = $this->model->read(['id'=>$this->param['id']]); 118 $info = $this->model->read(['id'=>$this->param['id']]);
  119 + if($info['id'] == $this->param['pid']){
  120 + $this->fail('不能成为自己的上级');
  121 + }
120 if($info['pid'] != $this->param['pid']){ 122 if($info['pid'] != $this->param['pid']){
121 //查询当前分类下是否有商品 123 //查询当前分类下是否有商品
122 $newsModel = new NewsModel(); 124 $newsModel = new NewsModel();