正在显示
1 个修改的文件
包含
11 行增加
和
13 行删除
| @@ -48,6 +48,8 @@ class GroupLogic extends BaseLogic | @@ -48,6 +48,8 @@ class GroupLogic extends BaseLogic | ||
| 48 | if($rs === false){ | 48 | if($rs === false){ |
| 49 | $this->fail('error'); | 49 | $this->fail('error'); |
| 50 | } | 50 | } |
| 51 | + //更新父类 | ||
| 52 | + $this->update_parent($this->param,$this->param['id']); | ||
| 51 | return $this->success(); | 53 | return $this->success(); |
| 52 | } | 54 | } |
| 53 | 55 | ||
| @@ -70,8 +72,10 @@ class GroupLogic extends BaseLogic | @@ -70,8 +72,10 @@ class GroupLogic extends BaseLogic | ||
| 70 | */ | 72 | */ |
| 71 | public function group_del(){ | 73 | public function group_del(){ |
| 72 | //查看当前是否拥有父类 | 74 | //查看当前是否拥有父类 |
| 73 | - $info = $this->model->read(['id'=>$this->param['id']]); | ||
| 74 | - if($info['pid']) | 75 | + $info = $this->model->read(['pid'=>$this->param['id']]); |
| 76 | + if($info !== false){ | ||
| 77 | + $this->fail('当前删除组织拥有下级组织,不允许删除'); | ||
| 78 | + } | ||
| 75 | $rs = $this->model->del($this->param); | 79 | $rs = $this->model->del($this->param); |
| 76 | if($rs === false){ | 80 | if($rs === false){ |
| 77 | $this->fail('error'); | 81 | $this->fail('error'); |
| @@ -85,8 +89,11 @@ class GroupLogic extends BaseLogic | @@ -85,8 +89,11 @@ class GroupLogic extends BaseLogic | ||
| 85 | * @method :post | 89 | * @method :post |
| 86 | * @time :2023/5/17 9:22 | 90 | * @time :2023/5/17 9:22 |
| 87 | */ | 91 | */ |
| 88 | - public function add_update_parent($param){ | ||
| 89 | - //查询当前添加组是否拥有父类 | 92 | + public function update_parent($param,$id = ''){ |
| 93 | + if(!empty($id)){ | ||
| 94 | + $param = $this->model->read(['id'=>$id]); | ||
| 95 | + } | ||
| 96 | + //查询当前组是否拥有父类 | ||
| 90 | if($param['pid'] != 0){ | 97 | if($param['pid'] != 0){ |
| 91 | $parent_info = $this->model->read(['id'=>$param['pid']]); | 98 | $parent_info = $this->model->read(['id'=>$param['pid']]); |
| 92 | //把添加成员合并到上级 | 99 | //把添加成员合并到上级 |
| @@ -104,13 +111,4 @@ class GroupLogic extends BaseLogic | @@ -104,13 +111,4 @@ class GroupLogic extends BaseLogic | ||
| 104 | return $this->success($rs); | 111 | return $this->success($rs); |
| 105 | } | 112 | } |
| 106 | 113 | ||
| 107 | - /** | ||
| 108 | - * @name :(删除)del_update_parent | ||
| 109 | - * @author :lyh | ||
| 110 | - * @method :post | ||
| 111 | - * @time :2023/5/17 9:56 | ||
| 112 | - */ | ||
| 113 | - public function del_update_parent(){ | ||
| 114 | - | ||
| 115 | - } | ||
| 116 | } | 114 | } |
-
请 注册 或 登录 后发表评论