提示优化
This commit is contained in:
@@ -21,11 +21,11 @@ class UserController
|
||||
$email = Util::getParam($request, 'email');
|
||||
$language = Util::getParam($request, 'language');
|
||||
if (Util::isEmpty($email)) {
|
||||
return Util::fail([], 'email' . trans('not_null'));
|
||||
return Util::fail([], trans('required_not_null'));
|
||||
}
|
||||
$password = Util::getParam($request, 'password');
|
||||
if (Util::isEmpty($password)) {
|
||||
return Util::fail([], 'password' . trans('not_null'));
|
||||
return Util::fail([], trans('required_not_null'));
|
||||
}
|
||||
|
||||
$user = User::select(['id', 'name', 'sex', 'role', 'avatar', 'email', 'password'])
|
||||
@@ -78,12 +78,15 @@ class UserController
|
||||
{
|
||||
$email = Util::getParam($request, 'email');
|
||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
return Util::fail([], 'email' . trans('not_null'));
|
||||
return Util::fail([], trans('required_not_null'));
|
||||
}
|
||||
|
||||
// 生成验证码
|
||||
$code = str_pad(random_int(0, 999999), 6, '0', STR_PAD_LEFT);
|
||||
|
||||
// $verification_code = Redis::get("verification_code:{$email}");
|
||||
// $code = $verification_code?:$code;
|
||||
// return Util::success($code, '验证码已发送');
|
||||
// 发送邮件
|
||||
$mailService = new MailService();
|
||||
if ($mailService->sendVerificationCode($email, $code)) {
|
||||
@@ -106,14 +109,14 @@ class UserController
|
||||
$email = Util::getParam($request, 'email', 'asdf');
|
||||
$code = Util::getParam($request, 'code');
|
||||
$sex = Util::getParam($request, 'sex', 0);
|
||||
$name = Util::getParam($request, 'name', 0);
|
||||
$name = Util::getParam($request, 'name', '');
|
||||
$password = Util::getParam($request, 'password');
|
||||
$mobile = Util::getParam($request, 'mobile');
|
||||
$id = Util::getParam($request, 'id');
|
||||
$language = Util::getParam($request, 'language');
|
||||
|
||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
return Util::fail([], 'email' . $email . trans('not_null'));
|
||||
return Util::fail([], trans('required_not_null'));
|
||||
}
|
||||
|
||||
$res = User::select('id', 'email')
|
||||
@@ -124,7 +127,7 @@ class UserController
|
||||
// }
|
||||
|
||||
if (Util::isEmpty($name)) {
|
||||
return Util::fail([], 'name' . trans('not_null'));
|
||||
// return Util::fail([], trans('required_not_null'));
|
||||
}
|
||||
|
||||
$verification_code = Redis::get("verification_code:{$email}");
|
||||
|
||||
Reference in New Issue
Block a user