修改判断新用户

This commit is contained in:
mkm 2024-03-01 10:00:16 +08:00
parent 53856b1c4a
commit 360745360e

View File

@ -734,6 +734,7 @@ class Auth extends BaseController
if (!$sms_code && !env('APP_DEBUG')) return app('json')->fail('验证码不正确');
$user = $repository->accountByUser($data['phone']);
$auth = $this->parseAuthToken($data['auth_token']);
$isNewUser = false;
if (!$user) {
$isNewUser = true;
$user = $repository->registr($data['phone'], null, $data['user_type']);
@ -747,7 +748,7 @@ class Auth extends BaseController
$tokenInfo = $repository->createToken($user);
$repository->loginAfter($user);
return app('json')->success(array_merge(['is_new_user' => $isNewUser ?? false], $repository->returnToken($user, $tokenInfo)));
return app('json')->success(array_merge(['is_new_user' => $isNewUser], $repository->returnToken($user, $tokenInfo)));
}
public function changePassword(ChangePasswordValidate $validate, UserRepository $repository)