From 81b837207a77c6948afb99101b54471ee8348db2 Mon Sep 17 00:00:00 2001 From: li kesong Date: Mon, 24 Jan 2022 17:48:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9unionid=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Middleware/WechatAuth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Middleware/WechatAuth.php b/app/Http/Middleware/WechatAuth.php index 970700c..97f785f 100644 --- a/app/Http/Middleware/WechatAuth.php +++ b/app/Http/Middleware/WechatAuth.php @@ -34,7 +34,7 @@ class WechatAuth $wechatUser = $app->oauth->user(); if (empty($wechatUser['id'])) { throw new \Exception('获取用户信息失败'); - } else if (empty($user['unionid'])) { + } else if (empty($wechatUser->original['unionid'])) { # TODO 调试unionid if (config('app.debug') && $request->server('REMOTE_ADDR') == '127.0.0.1') { $wechatUser['unionid'] = 'onhl355f-ofX5e0-4I4vn0bswVPM'; @@ -43,7 +43,7 @@ class WechatAuth } } - $user = User::where('unionid', $wechatUser->unionid)->first(); + $user = User::where('unionid', $wechatUser->original['unionid'])->first(); if (!$user) { throw new Exception('您的账号未在小程序上登录过,获取用户信息失败'); }