Merge branch 'master' of http://114.215.101.231:8099/guosheng/enterprise into heshupeng
正在显示
1 个修改的文件
包含
17 行增加
和
0 行删除
@@ -79,6 +79,9 @@ class User extends Backend | @@ -79,6 +79,9 @@ class User extends Backend | ||
79 | if ($this->dataLimit && $this->dataLimitFieldAutoFill) { | 79 | if ($this->dataLimit && $this->dataLimitFieldAutoFill) { |
80 | $params[$this->dataLimitField] = $this->auth->id; | 80 | $params[$this->dataLimitField] = $this->auth->id; |
81 | } | 81 | } |
82 | + if($this->check_identity($params['card'])) { | ||
83 | + $this->error('该身份证号已存在'); | ||
84 | + } | ||
82 | $result = false; | 85 | $result = false; |
83 | Db::startTrans(); | 86 | Db::startTrans(); |
84 | try { | 87 | try { |
@@ -143,6 +146,9 @@ class User extends Backend | @@ -143,6 +146,9 @@ class User extends Backend | ||
143 | $this->error('有效期不能为空'); | 146 | $this->error('有效期不能为空'); |
144 | } | 147 | } |
145 | $params['expirationtime'] = strtotime($params['expirationtime']); | 148 | $params['expirationtime'] = strtotime($params['expirationtime']); |
149 | + if($this->check_identity($params['card'],$ids)) { | ||
150 | + $this->error('该身份证号已存在'); | ||
151 | + } | ||
146 | if ($params) { | 152 | if ($params) { |
147 | $params = $this->preExcludeFields($params); | 153 | $params = $this->preExcludeFields($params); |
148 | $result = false; | 154 | $result = false; |
@@ -178,4 +184,15 @@ class User extends Backend | @@ -178,4 +184,15 @@ class User extends Backend | ||
178 | return $this->view->fetch(); | 184 | return $this->view->fetch(); |
179 | } | 185 | } |
180 | 186 | ||
187 | + private function check_identity($identity,$ids = null) | ||
188 | + { | ||
189 | + $where = [ | ||
190 | + 'card' => $identity | ||
191 | + ]; | ||
192 | + if($ids) { | ||
193 | + $where['id'] = ['neq',$ids]; | ||
194 | + } | ||
195 | + $user = $this->model->where($where)->find(); | ||
196 | + return $user ? true : false; | ||
197 | + } | ||
181 | } | 198 | } |
-
请 注册 或 登录 后发表评论