|
|
|
@ -81,7 +81,7 @@ class Login extends Base |
|
|
|
|
|
|
|
//获取AccessToken |
|
|
|
$getAccessTokenUrl = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' . |
|
|
|
env('wechat.appid') . '&secret=' . env('app.appsecret') . '&code=' . $code . |
|
|
|
env('wechat.appid') . '&secret=' . env('wechat.appsecret') . '&code=' . $code . |
|
|
|
'&grant_type=authorization_code'; |
|
|
|
|
|
|
|
$tokenArr = file_get_contents($getAccessTokenUrl); |
|
|
|
@ -100,7 +100,7 @@ class Login extends Base |
|
|
|
|
|
|
|
private function doLogin(string $openid, array $userDetail): Response { |
|
|
|
$userInfo = (new WechatUser())->where('openid', $openid)->find(); |
|
|
|
if (empty($userInfo)) { |
|
|
|
if (!empty($userInfo)) { |
|
|
|
$userInfo = WechatUser::create([ |
|
|
|
'nickname' => $userDetail['nickname'], |
|
|
|
'openid' => $openid, |
|
|
|
|