Merge branch 'dev' of http://47.244.231.31:8099/zhl/globalso-v6 into dev
正在显示
3 个修改的文件
包含
46 行增加
和
8 行删除
| @@ -54,7 +54,7 @@ class AyrShareController extends BaseController | @@ -54,7 +54,7 @@ class AyrShareController extends BaseController | ||
| 54 | $this->request->validate([ | 54 | $this->request->validate([ |
| 55 | 'id'=>['required'], | 55 | 'id'=>['required'], |
| 56 | ],[ | 56 | ],[ |
| 57 | - 'id.required' => 'SHARE_ID不能为空', | 57 | + 'id.required' => 'ID不能为空', |
| 58 | ]); | 58 | ]); |
| 59 | $info = $ayrShareLogic->ayr_share_info(); | 59 | $info = $ayrShareLogic->ayr_share_info(); |
| 60 | $ayrShareHelper = new AyrShareHelper(); | 60 | $ayrShareHelper = new AyrShareHelper(); |
| @@ -62,12 +62,14 @@ class AyrShareController extends BaseController | @@ -62,12 +62,14 @@ class AyrShareController extends BaseController | ||
| 62 | if(isset($share_info['activeSocialAccounts'])){ | 62 | if(isset($share_info['activeSocialAccounts'])){ |
| 63 | $str = json_encode($share_info['activeSocialAccounts']); | 63 | $str = json_encode($share_info['activeSocialAccounts']); |
| 64 | if($str != $info['bind_platforms']){ | 64 | if($str != $info['bind_platforms']){ |
| 65 | - $res = $ayrShareLogic->ayr_share_edit(['bind_platforms'=>$str],$this->param['share_id']); | 65 | + $ayrShareLogic->ayr_share_edit(['bind_platforms'=>$str],$this->param['id']); |
| 66 | + $res = true; | ||
| 66 | }else{ | 67 | }else{ |
| 67 | $res = false; | 68 | $res = false; |
| 68 | } | 69 | } |
| 69 | }else{ | 70 | }else{ |
| 70 | - $res = $ayrShareLogic->ayr_share_edit(['bind_platforms'=>''],$this->param['share_id']); | 71 | + $ayrShareLogic->ayr_share_edit(['bind_platforms'=>''],$this->param['id']); |
| 72 | + $res = true; | ||
| 71 | } | 73 | } |
| 72 | $this->response('success',Code::SUCCESS,['is_true'=>$res]); | 74 | $this->response('success',Code::SUCCESS,['is_true'=>$res]); |
| 73 | } | 75 | } |
| @@ -113,7 +115,6 @@ class AyrShareController extends BaseController | @@ -113,7 +115,6 @@ class AyrShareController extends BaseController | ||
| 113 | //发送请求删除社交用户 | 115 | //发送请求删除社交用户 |
| 114 | $ayrShareHelper = new AyrShareHelper(); | 116 | $ayrShareHelper = new AyrShareHelper(); |
| 115 | $res = $ayrShareHelper->deleted_profiles($data); | 117 | $res = $ayrShareHelper->deleted_profiles($data); |
| 116 | - | ||
| 117 | if($res['status'] == 'fail'){ | 118 | if($res['status'] == 'fail'){ |
| 118 | $this->response('同步删除失败'); | 119 | $this->response('同步删除失败'); |
| 119 | } | 120 | } |
| @@ -52,7 +52,7 @@ class AyrShareLogic extends BaseLogic | @@ -52,7 +52,7 @@ class AyrShareLogic extends BaseLogic | ||
| 52 | 'title'=>$res['title'], | 52 | 'title'=>$res['title'], |
| 53 | 'ref_id'=>$res['refId'], | 53 | 'ref_id'=>$res['refId'], |
| 54 | 'profile_key'=>$res['profileKey'], | 54 | 'profile_key'=>$res['profileKey'], |
| 55 | - 'user_id'=>$this->user['id'], | 55 | + 'operator_id'=>$this->user['id'], |
| 56 | 'project_id'=>$this->user['project_id'], | 56 | 'project_id'=>$this->user['project_id'], |
| 57 | 'name'=>$this->param['name'], | 57 | 'name'=>$this->param['name'], |
| 58 | ]; | 58 | ]; |
| @@ -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 | ||
| @@ -45,6 +48,8 @@ class GroupLogic extends BaseLogic | @@ -45,6 +48,8 @@ class GroupLogic extends BaseLogic | ||
| 45 | if($rs === false){ | 48 | if($rs === false){ |
| 46 | $this->fail('error'); | 49 | $this->fail('error'); |
| 47 | } | 50 | } |
| 51 | + //更新父类 | ||
| 52 | + $this->update_parent($this->param,$this->param['id']); | ||
| 48 | return $this->success(); | 53 | return $this->success(); |
| 49 | } | 54 | } |
| 50 | 55 | ||
| @@ -66,12 +71,44 @@ class GroupLogic extends BaseLogic | @@ -66,12 +71,44 @@ class GroupLogic extends BaseLogic | ||
| 66 | * @method | 71 | * @method |
| 67 | */ | 72 | */ |
| 68 | public function group_del(){ | 73 | public function group_del(){ |
| 69 | - $ids = $this->param['id']; | ||
| 70 | - $this->param['id'] = ['in',$this->param['id']]; | ||
| 71 | - $rs = $this->del($this->param,$ids); | 74 | + //查看当前是否拥有父类 |
| 75 | + $info = $this->model->read(['pid'=>$this->param['id']]); | ||
| 76 | + if($info !== false){ | ||
| 77 | + $this->fail('当前删除组织拥有下级组织,不允许删除'); | ||
| 78 | + } | ||
| 79 | + $rs = $this->model->del($this->param); | ||
| 72 | if($rs === false){ | 80 | if($rs === false){ |
| 73 | $this->fail('error'); | 81 | $this->fail('error'); |
| 74 | } | 82 | } |
| 75 | return $this->success(); | 83 | return $this->success(); |
| 76 | } | 84 | } |
| 85 | + | ||
| 86 | + /** | ||
| 87 | + * @name :(更新父类成员)update_parent | ||
| 88 | + * @author :lyh | ||
| 89 | + * @method :post | ||
| 90 | + * @time :2023/5/17 9:22 | ||
| 91 | + */ | ||
| 92 | + public function update_parent($param,$id = ''){ | ||
| 93 | + if(!empty($id)){ | ||
| 94 | + $param = $this->model->read(['id'=>$id]); | ||
| 95 | + } | ||
| 96 | + //查询当前组是否拥有父类 | ||
| 97 | + if($param['pid'] != 0){ | ||
| 98 | + $parent_info = $this->model->read(['id'=>$param['pid']]); | ||
| 99 | + //把添加成员合并到上级 | ||
| 100 | + $str = trim($param['user_list'].$parent_info['user_list'],','); | ||
| 101 | + $mergedString = ','.implode(',', array_unique(explode(',', $str))).','; | ||
| 102 | + $rs = $this->model->edit(['user_list'=>$mergedString],['id'=>$parent_info['id']]); | ||
| 103 | + if($rs === false){ | ||
| 104 | + $this->fail('更新父级失败'); | ||
| 105 | + } | ||
| 106 | + //查看当前父级是否还拥有父级 | ||
| 107 | + if($parent_info['pid'] != 0){ | ||
| 108 | + $rs = $this->update_parent($parent_info); | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + return $this->success($rs); | ||
| 112 | + } | ||
| 113 | + | ||
| 77 | } | 114 | } |
-
请 注册 或 登录 后发表评论