Skip to content

Commit

Permalink
1. 完善decryptData接口
Browse files Browse the repository at this point in the history
  • Loading branch information
shinn-lancelot committed Dec 20, 2018
1 parent 9966b25 commit e281d0f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/MiniProgram.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,17 @@ 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'])) {
$res['code'] = -101;
$res['msg'] = Common::getErrorMsg($sessionData['errcode']);
return $res;
}
$openid = $sessionData['openid'];
$openId = $sessionData['openid'];
$sessionKey = $sessionData['session_key'];
}

Expand Down

0 comments on commit e281d0f

Please sign in to comment.