|
...
|
...
|
@@ -30,6 +30,9 @@ class GroupLogic extends BaseLogic |
|
|
|
if($rs === false){
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
|
|
if(isset($this->param['pid']) && !empty($this->param['pid'])){
|
|
|
|
$this->add_update_parent($this->param);
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -66,12 +69,48 @@ class GroupLogic extends BaseLogic |
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function group_del(){
|
|
|
|
$ids = $this->param['id'];
|
|
|
|
$this->param['id'] = ['in',$this->param['id']];
|
|
|
|
$rs = $this->del($this->param,$ids);
|
|
|
|
//查看当前是否拥有父类
|
|
|
|
$info = $this->model->read(['id'=>$this->param['id']]);
|
|
|
|
if($info['pid'])
|
|
|
|
$rs = $this->model->del($this->param);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(更新父类成员)update_parent
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/5/17 9:22
|
|
|
|
*/
|
|
|
|
public function add_update_parent($param){
|
|
|
|
//查询当前添加组是否拥有父类
|
|
|
|
if($param['pid'] != 0){
|
|
|
|
$parent_info = $this->model->read(['id'=>$param['pid']]);
|
|
|
|
//把添加成员合并到上级
|
|
|
|
$str = trim($param['user_list'].$parent_info['user_list'],',');
|
|
|
|
$mergedString = ','.implode(',', array_unique(explode(',', $str))).',';
|
|
|
|
$rs = $this->model->edit(['user_list'=>$mergedString],['id'=>$parent_info['id']]);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('更新父级失败');
|
|
|
|
}
|
|
|
|
//查看当前父级是否还拥有父级
|
|
|
|
if($parent_info['pid'] != 0){
|
|
|
|
$rs = $this->update_parent($parent_info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($rs);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(删除)del_update_parent
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/5/17 9:56
|
|
|
|
*/
|
|
|
|
public function del_update_parent(){
|
|
|
|
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|