Skip to content

Commit e281d0f

Browse files
1. 完善decryptData接口
1 parent 9966b25 commit e281d0f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/MiniProgram.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,17 @@ public function decryptData($paramArr = array())
9191
$res['data'] = array();
9292

9393
// 1.获取openid、session_key(若存在session_key,则默认理解为session_key未过期,直接使用其进行解密)
94-
if ($paramArr['session_key']) {
95-
$openid = isset($paramArr['openid']) ? $paramArr['openid'] : '';
96-
$sessionKey = $paramArr['session_key'];
94+
if (isset($paramArr['sessionKey']) && $paramArr['sessionKey']) {
95+
$openId = isset($paramArr['openId']) ? $paramArr['openId'] : '';
96+
$sessionKey = $paramArr['sessionKey'];
9797
} else {
9898
$sessionData = $this->jscode2Session($paramArr['code']);
9999
if (isset($sessionData['errcode'])) {
100100
$res['code'] = -101;
101101
$res['msg'] = Common::getErrorMsg($sessionData['errcode']);
102102
return $res;
103103
}
104-
$openid = $sessionData['openid'];
104+
$openId = $sessionData['openid'];
105105
$sessionKey = $sessionData['session_key'];
106106
}
107107

0 commit comments

Comments
 (0)