正在显示
1 个修改的文件
包含
10 行增加
和
30 行删除
| @@ -42,6 +42,9 @@ class UserLogic extends BaseLogic | @@ -42,6 +42,9 @@ class UserLogic extends BaseLogic | ||
| 42 | if($info !== false){ | 42 | if($info !== false){ |
| 43 | $this->fail('当前手机号码已注册'); | 43 | $this->fail('当前手机号码已注册'); |
| 44 | } | 44 | } |
| 45 | + if(!isset($this->param['role']) || empty($this->param['role'])){ | ||
| 46 | + $this->fail('一个账号只允许一个超级管理员,请先添加角色'); | ||
| 47 | + } | ||
| 45 | $this->param['create_id'] = $this->user['id']; | 48 | $this->param['create_id'] = $this->user['id']; |
| 46 | $this->param['operator_id'] = $this->user['id']; | 49 | $this->param['operator_id'] = $this->user['id']; |
| 47 | $this->param['project_id'] = $this->user['project_id']; | 50 | $this->param['project_id'] = $this->user['project_id']; |
| @@ -74,7 +77,13 @@ class UserLogic extends BaseLogic | @@ -74,7 +77,13 @@ class UserLogic extends BaseLogic | ||
| 74 | } | 77 | } |
| 75 | $this->param['type'] = 1; | 78 | $this->param['type'] = 1; |
| 76 | $this->param['operator_id'] = $this->user['id']; | 79 | $this->param['operator_id'] = $this->user['id']; |
| 77 | - $this->edits(); | 80 | + if(isset($this->param['password']) && empty($this->param['password'])){ |
| 81 | + $this->param['password'] = base64_encode(md5($this->param['password'])); | ||
| 82 | + } | ||
| 83 | + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 84 | + if($rs === false){ | ||
| 85 | + $this->fail('系统错误,请联系管理员'); | ||
| 86 | + } | ||
| 78 | return $this->success(); | 87 | return $this->success(); |
| 79 | } | 88 | } |
| 80 | 89 | ||
| @@ -107,33 +116,4 @@ class UserLogic extends BaseLogic | @@ -107,33 +116,4 @@ class UserLogic extends BaseLogic | ||
| 107 | //对应删除组织架构 | 116 | //对应删除组织架构 |
| 108 | return $this->success(); | 117 | return $this->success(); |
| 109 | } | 118 | } |
| 110 | - | ||
| 111 | - /** | ||
| 112 | - * @param $param | ||
| 113 | - * @remark :编辑用户 | ||
| 114 | - * @name :edits | ||
| 115 | - * @author :lyh | ||
| 116 | - * @method :post | ||
| 117 | - * @time :2023/6/17 16:41 | ||
| 118 | - */ | ||
| 119 | - public function edits(){ | ||
| 120 | - if(!isset($this->param['password']) || empty($this->param['password'])){ | ||
| 121 | - unset($this->param['password']); | ||
| 122 | - }else{ | ||
| 123 | - $this->param['password'] = base64_encode(md5($this->param['password'])); | ||
| 124 | - } | ||
| 125 | - $info = $this->model->read(['mobile'=>$this->param['mobile'], | ||
| 126 | - 'project_id'=>$this->user['project_id'],'id'=>['!=',$this->param['id']]]); | ||
| 127 | - if($info !== false){ | ||
| 128 | - $this->fail('当前手机号码已注册'); | ||
| 129 | - } | ||
| 130 | - //密码加密 | ||
| 131 | - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 132 | - if($rs === false){ | ||
| 133 | - $this->fail('系统错误,请联系管理员'); | ||
| 134 | - } | ||
| 135 | - //清空当前用户登录缓存 | ||
| 136 | - Cache::pull($this->user['token']); | ||
| 137 | - return $this->success(); | ||
| 138 | - } | ||
| 139 | } | 119 | } |
-
请 注册 或 登录 后发表评论