正在显示
2 个修改的文件
包含
5 行增加
和
2 行删除
| @@ -46,6 +46,11 @@ class UserLogic extends BaseLogic | @@ -46,6 +46,11 @@ class UserLogic extends BaseLogic | ||
| 46 | * @method | 46 | * @method |
| 47 | */ | 47 | */ |
| 48 | public function user_add(){ | 48 | public function user_add(){ |
| 49 | + //验证当前项目是否已存在超级管理员 | ||
| 50 | + $info = $this->model->read(['project_id'=>$this->param['project_id'],'role_id'=>0]); | ||
| 51 | + if($info !== false){ | ||
| 52 | + $this->fail('一个项目只允许一个超级管理员'); | ||
| 53 | + } | ||
| 49 | $this->verifyMobile();//验证手机号 | 54 | $this->verifyMobile();//验证手机号 |
| 50 | $this->param['password'] = base64_encode(md5($this->param['password'])); | 55 | $this->param['password'] = base64_encode(md5($this->param['password'])); |
| 51 | $rs = $this->model->add($this->param); | 56 | $rs = $this->model->add($this->param); |
| @@ -28,7 +28,6 @@ class UserRequest extends FormRequest | @@ -28,7 +28,6 @@ class UserRequest extends FormRequest | ||
| 28 | 'password'=>'required|string|min:5', | 28 | 'password'=>'required|string|min:5', |
| 29 | 'project_id'=>'required', | 29 | 'project_id'=>'required', |
| 30 | 'name'=>'required|max:20', | 30 | 'name'=>'required|max:20', |
| 31 | - 'role_id'=>'required' | ||
| 32 | ]; | 31 | ]; |
| 33 | } | 32 | } |
| 34 | 33 | ||
| @@ -44,7 +43,6 @@ class UserRequest extends FormRequest | @@ -44,7 +43,6 @@ class UserRequest extends FormRequest | ||
| 44 | 'password.min' => '密码不小于5字符.', | 43 | 'password.min' => '密码不小于5字符.', |
| 45 | 'name.required'=>'名称必须填写', | 44 | 'name.required'=>'名称必须填写', |
| 46 | 'name.min' => '名称不小于5字符.', | 45 | 'name.min' => '名称不小于5字符.', |
| 47 | - 'role_id.required'=>'角色必须填写', | ||
| 48 | ]; | 46 | ]; |
| 49 | } | 47 | } |
| 50 | } | 48 | } |
-
请 注册 或 登录 后发表评论