From 54bf58b197e6bcc774fa84c6ee3e50103e699f95 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 7 Mar 2024 17:41:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95=E5=BE=AE=E4=BF=A1=E6=8E=88?= =?UTF-8?q?=E6=9D=83=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/Auth.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index f0f7bb8b..06267ba7 100755 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -874,9 +874,10 @@ class Auth extends BaseController throw new ValidateException('授权失败[003]'); return $user; } else if ($auth['type'] === 'app_wechat') { - $oauth = WechatService::create()->getApplication()->oauth; + $oauth = WechatService::create(true)->getApplication()->oauth; + $accessToken = $oauth->getAccessToken($data['code']); try { - $wechatInfo = $oauth->user(new AccessToken(['access_token' => $data['code'], 'openid' => $data['openid']]))->getOriginal(); + $wechatInfo = $oauth->user($accessToken)->getOriginal(); } catch (Exception $e) { throw new ValidateException('授权失败[001]' . $e->getMessage()); }