From e281d0fb7479c3a619af7a8195af0c90646eb6c5 Mon Sep 17 00:00:00 2001 From: shinn-lancelot <945226793@qq.com> Date: Thu, 20 Dec 2018 22:58:54 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E5=AE=8C=E5=96=84decryptData=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MiniProgram.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MiniProgram.php b/src/MiniProgram.php index b7f2a23..017da50 100644 --- a/src/MiniProgram.php +++ b/src/MiniProgram.php @@ -91,9 +91,9 @@ public function decryptData($paramArr = array()) $res['data'] = array(); // 1.获取openid、session_key(若存在session_key,则默认理解为session_key未过期,直接使用其进行解密) - if ($paramArr['session_key']) { - $openid = isset($paramArr['openid']) ? $paramArr['openid'] : ''; - $sessionKey = $paramArr['session_key']; + if (isset($paramArr['sessionKey']) && $paramArr['sessionKey']) { + $openId = isset($paramArr['openId']) ? $paramArr['openId'] : ''; + $sessionKey = $paramArr['sessionKey']; } else { $sessionData = $this->jscode2Session($paramArr['code']); if (isset($sessionData['errcode'])) { @@ -101,7 +101,7 @@ public function decryptData($paramArr = array()) $res['msg'] = Common::getErrorMsg($sessionData['errcode']); return $res; } - $openid = $sessionData['openid']; + $openId = $sessionData['openid']; $sessionKey = $sessionData['session_key']; }