手机验证码注册

This commit is contained in:
chenbo 2024-01-02 18:18:52 +08:00
parent 0fe66b9c21
commit 8c6838fbf2
1 changed files with 8 additions and 1 deletions

View File

@ -14,6 +14,7 @@
namespace app\api\logic;
use app\api\validate\LoginAccountValidate;
use app\common\cache\WebScanLoginCache;
use app\common\logic\BaseLogic;
use app\common\model\auth\Admin;
@ -53,7 +54,13 @@ class LoginLogic extends BaseLogic
$passwordSalt = Config::get('project.unique_identification');
$password = create_password($params['password'], $passwordSalt);
$avatar = ConfigService::get('default_image', 'user_avatar');
// 校验短信验证码
$verifyCode = $params['verify_code'];
$params['account'] = intval($params['mobile']);
if((new LoginAccountValidate())->checkCode($verifyCode, [], $params) === true) {
self::setError('验证码错误');
return false;
}
Db::transaction(function () use($userSn,$password,$avatar,$params) {
$user = User::create([
'sn' => $userSn,