From 234b7ae54d6c9e8b92aecec32dd7cec88ed9f85f Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Mon, 29 Jul 2024 09:57:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=99=BB=E5=BD=95=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E4=B8=BAget3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/wechat/Login.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controller/wechat/Login.php b/app/controller/wechat/Login.php index a7cb948..4d9412b 100644 --- a/app/controller/wechat/Login.php +++ b/app/controller/wechat/Login.php @@ -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,