正在显示
3 个修改的文件
包含
19 行增加
和
2 行删除
| @@ -58,6 +58,13 @@ class UserLogic extends BaseLogic | @@ -58,6 +58,13 @@ class UserLogic extends BaseLogic | ||
| 58 | $projectModel = new Project(); | 58 | $projectModel = new Project(); |
| 59 | $projectModel->edit(['lead_name'=>$this->param['name'],'mobile'=>$this->param['mobile']],['id'=>$info['project_id']]); | 59 | $projectModel->edit(['lead_name'=>$this->param['name'],'mobile'=>$this->param['mobile']],['id'=>$info['project_id']]); |
| 60 | } | 60 | } |
| 61 | + if(isset($this->param['role_id']) && ($this->param['role_id'] != 0)){ | ||
| 62 | + $roleModel = new ProjectRole(); | ||
| 63 | + $roleInfo = $roleModel->read(['project_id'=>$info['project_id'],'id'=>$this->param['role_id']]); | ||
| 64 | + if($roleInfo == false){ | ||
| 65 | + $this->fail('当前角色不是当前项目角色'); | ||
| 66 | + } | ||
| 67 | + } | ||
| 61 | $this->param = $this->editPassword($this->param); | 68 | $this->param = $this->editPassword($this->param); |
| 62 | $rs = $this->model->edit($this->param, ['id' => $this->param['id']]); | 69 | $rs = $this->model->edit($this->param, ['id' => $this->param['id']]); |
| 63 | } else { | 70 | } else { |
| @@ -196,10 +203,10 @@ class UserLogic extends BaseLogic | @@ -196,10 +203,10 @@ class UserLogic extends BaseLogic | ||
| 196 | */ | 203 | */ |
| 197 | public function setRole(){ | 204 | public function setRole(){ |
| 198 | DB::beginTransaction(); | 205 | DB::beginTransaction(); |
| 199 | - //获取当前用户的觉得 | 206 | + //获取当前用户的角色 |
| 200 | $roleModel = new ProjectRole(); | 207 | $roleModel = new ProjectRole(); |
| 201 | $roleInfo = $roleModel->where('project_id',$this->param['project_id'])->orderBy('id','asc')->first(); | 208 | $roleInfo = $roleModel->where('project_id',$this->param['project_id'])->orderBy('id','asc')->first(); |
| 202 | - $info = $this->model->read(['role_id'=>0]); | 209 | + $info = $this->model->read(['role_id'=>0,'project_id'=>$this->param['project_id']]); |
| 203 | if(empty($info) || empty($roleInfo)){ | 210 | if(empty($info) || empty($roleInfo)){ |
| 204 | $this->fail('请先添加角色'); | 211 | $this->fail('请先添加角色'); |
| 205 | } | 212 | } |
| @@ -4,6 +4,7 @@ namespace App\Http\Logic\Bside\User; | @@ -4,6 +4,7 @@ namespace App\Http\Logic\Bside\User; | ||
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Http\Logic\Bside\BaseLogic; | 6 | use App\Http\Logic\Bside\BaseLogic; |
| 7 | +use App\Models\User\ProjectRole; | ||
| 7 | use App\Models\User\User; | 8 | use App\Models\User\User; |
| 8 | use Illuminate\Support\Facades\Cache; | 9 | use Illuminate\Support\Facades\Cache; |
| 9 | use Illuminate\Support\Facades\DB; | 10 | use Illuminate\Support\Facades\DB; |
| @@ -81,6 +82,13 @@ class UserLogic extends BaseLogic | @@ -81,6 +82,13 @@ class UserLogic extends BaseLogic | ||
| 81 | if(isset($this->param['password']) && !empty($this->param['password'])){ | 82 | if(isset($this->param['password']) && !empty($this->param['password'])){ |
| 82 | $this->param['password'] = base64_encode(md5($this->param['password'])); | 83 | $this->param['password'] = base64_encode(md5($this->param['password'])); |
| 83 | } | 84 | } |
| 85 | + if(isset($this->param['role_id']) && ($this->param['role_id'] != 0)){ | ||
| 86 | + $roleModel = new ProjectRole(); | ||
| 87 | + $roleInfo = $roleModel->read(['project_id'=>$this->user['project_id'],'id'=>$this->param['role_id']]); | ||
| 88 | + if($roleInfo == false){ | ||
| 89 | + $this->fail('当前角色不是当前项目角色'); | ||
| 90 | + } | ||
| 91 | + } | ||
| 84 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | 92 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 85 | if($rs === false){ | 93 | if($rs === false){ |
| 86 | $this->fail('系统错误,请联系管理员'); | 94 | $this->fail('系统错误,请联系管理员'); |
| @@ -117,4 +125,5 @@ class UserLogic extends BaseLogic | @@ -117,4 +125,5 @@ class UserLogic extends BaseLogic | ||
| 117 | //对应删除组织架构 | 125 | //对应删除组织架构 |
| 118 | return $this->success(); | 126 | return $this->success(); |
| 119 | } | 127 | } |
| 128 | + | ||
| 120 | } | 129 | } |
-
请 注册 或 登录 后发表评论