fix: 修复添加用户验证器问题

This commit is contained in:
Ying
2023-06-19 22:03:42 +08:00
parent 9126f3bad7
commit 3dcd338027

View File

@@ -98,15 +98,10 @@ class User extends AdminController
{ {
if (request()->isPost()) { if (request()->isPost()) {
$post = request()->post(); $post = request()->post();
$post = request_validate_rules($post, get_class($this->model));
if (empty($post) || !is_array($post)) {
return $this->error($post);
}
// 禁止重复注册 // 禁止重复注册
$whereName[] = ['nickname', '=', $post['nickname']]; $whereName[] = ['nickname', '=', $post['nickname']];
$whereEmail[] = ['email', '=', $post['email']]; $whereEmail[] = ['email', '=', $post['email']];
if ($this->model->whereOr([$whereName, $whereEmail])->find()) { if ($this->model->whereOr([$whereName, $whereEmail])->findOrEmpty()->toArray()) {
return $this->error('该用户ID或邮箱已经存在'); return $this->error('该用户ID或邮箱已经存在');
} }