修改判断新用户
This commit is contained in:
parent
53856b1c4a
commit
360745360e
@ -734,6 +734,7 @@ class Auth extends BaseController
|
|||||||
if (!$sms_code && !env('APP_DEBUG')) return app('json')->fail('验证码不正确');
|
if (!$sms_code && !env('APP_DEBUG')) return app('json')->fail('验证码不正确');
|
||||||
$user = $repository->accountByUser($data['phone']);
|
$user = $repository->accountByUser($data['phone']);
|
||||||
$auth = $this->parseAuthToken($data['auth_token']);
|
$auth = $this->parseAuthToken($data['auth_token']);
|
||||||
|
$isNewUser = false;
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
$isNewUser = true;
|
$isNewUser = true;
|
||||||
$user = $repository->registr($data['phone'], null, $data['user_type']);
|
$user = $repository->registr($data['phone'], null, $data['user_type']);
|
||||||
@ -747,7 +748,7 @@ class Auth extends BaseController
|
|||||||
$tokenInfo = $repository->createToken($user);
|
$tokenInfo = $repository->createToken($user);
|
||||||
$repository->loginAfter($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)
|
public function changePassword(ChangePasswordValidate $validate, UserRepository $repository)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user