新增:支持用户使用用户名、手机号码、邮箱登录

This commit is contained in:
HDM58\hdm58 2023-12-12 17:53:42 +08:00
parent 6f0389b16c
commit fd2c3015e9

View File

@ -32,12 +32,9 @@ class Login
return to_assign(1, $e->getError());
}
$admin = Db::name('Admin')->where(['username' => $param['username']])->find();
$admin = Db::name('Admin')->where(['username|mobile|email' => $param['username']])->find();
if (empty($admin)) {
$admin = Db::name('Admin')->where(['mobile' => $param['username']])->find();
if (empty($admin)) {
return to_assign(1, '用户名或手机号码错误');
}
return to_assign(1, '用户名或手机号码错误');
}
$param['pwd'] = set_password($param['password'], $admin['salt']);
if ($admin['pwd'] !== $param['pwd']) {