作者 何书鹏

Merge branch 'master' of http://114.215.101.231:8099/guosheng/enterprise into heshupeng

... ... @@ -79,6 +79,9 @@ class User extends Backend
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
$params[$this->dataLimitField] = $this->auth->id;
}
if($this->check_identity($params['card'])) {
$this->error('该身份证号已存在');
}
$result = false;
Db::startTrans();
try {
... ... @@ -143,6 +146,9 @@ class User extends Backend
$this->error('有效期不能为空');
}
$params['expirationtime'] = strtotime($params['expirationtime']);
if($this->check_identity($params['card'],$ids)) {
$this->error('该身份证号已存在');
}
if ($params) {
$params = $this->preExcludeFields($params);
$result = false;
... ... @@ -178,4 +184,15 @@ class User extends Backend
return $this->view->fetch();
}
private function check_identity($identity,$ids = null)
{
$where = [
'card' => $identity
];
if($ids) {
$where['id'] = ['neq',$ids];
}
$user = $this->model->where($where)->find();
return $user ? true : false;
}
}
... ...