|
@@ -30,6 +30,9 @@ class GroupLogic extends BaseLogic |
|
@@ -30,6 +30,9 @@ class GroupLogic extends BaseLogic |
|
30
|
if($rs === false){
|
30
|
if($rs === false){
|
|
31
|
$this->fail('error');
|
31
|
$this->fail('error');
|
|
32
|
}
|
32
|
}
|
|
|
|
33
|
+ if(isset($this->param['pid']) && !empty($this->param['pid'])){
|
|
|
|
34
|
+ $this->add_update_parent($this->param);
|
|
|
|
35
|
+ }
|
|
33
|
return $this->success();
|
36
|
return $this->success();
|
|
34
|
}
|
37
|
}
|
|
35
|
|
38
|
|
|
@@ -66,12 +69,48 @@ class GroupLogic extends BaseLogic |
|
@@ -66,12 +69,48 @@ class GroupLogic extends BaseLogic |
|
66
|
* @method
|
69
|
* @method
|
|
67
|
*/
|
70
|
*/
|
|
68
|
public function group_del(){
|
71
|
public function group_del(){
|
|
69
|
- $ids = $this->param['id'];
|
|
|
|
70
|
- $this->param['id'] = ['in',$this->param['id']];
|
|
|
|
71
|
- $rs = $this->del($this->param,$ids);
|
72
|
+ //查看当前是否拥有父类
|
|
|
|
73
|
+ $info = $this->model->read(['id'=>$this->param['id']]);
|
|
|
|
74
|
+ if($info['pid'])
|
|
|
|
75
|
+ $rs = $this->model->del($this->param);
|
|
72
|
if($rs === false){
|
76
|
if($rs === false){
|
|
73
|
$this->fail('error');
|
77
|
$this->fail('error');
|
|
74
|
}
|
78
|
}
|
|
75
|
return $this->success();
|
79
|
return $this->success();
|
|
76
|
}
|
80
|
}
|
|
|
|
81
|
+
|
|
|
|
82
|
+ /**
|
|
|
|
83
|
+ * @name :(更新父类成员)update_parent
|
|
|
|
84
|
+ * @author :lyh
|
|
|
|
85
|
+ * @method :post
|
|
|
|
86
|
+ * @time :2023/5/17 9:22
|
|
|
|
87
|
+ */
|
|
|
|
88
|
+ public function add_update_parent($param){
|
|
|
|
89
|
+ //查询当前添加组是否拥有父类
|
|
|
|
90
|
+ if($param['pid'] != 0){
|
|
|
|
91
|
+ $parent_info = $this->model->read(['id'=>$param['pid']]);
|
|
|
|
92
|
+ //把添加成员合并到上级
|
|
|
|
93
|
+ $str = trim($param['user_list'].$parent_info['user_list'],',');
|
|
|
|
94
|
+ $mergedString = ','.implode(',', array_unique(explode(',', $str))).',';
|
|
|
|
95
|
+ $rs = $this->model->edit(['user_list'=>$mergedString],['id'=>$parent_info['id']]);
|
|
|
|
96
|
+ if($rs === false){
|
|
|
|
97
|
+ $this->fail('更新父级失败');
|
|
|
|
98
|
+ }
|
|
|
|
99
|
+ //查看当前父级是否还拥有父级
|
|
|
|
100
|
+ if($parent_info['pid'] != 0){
|
|
|
|
101
|
+ $rs = $this->update_parent($parent_info);
|
|
|
|
102
|
+ }
|
|
|
|
103
|
+ }
|
|
|
|
104
|
+ return $this->success($rs);
|
|
|
|
105
|
+ }
|
|
|
|
106
|
+
|
|
|
|
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
|
+ }
|
|
77
|
} |
116
|
} |