Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
anoxia committed Feb 2, 2019
1 parent 3399b9d commit 30e9a04
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Wx/Mini.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ public function get($code)
$response = $this->rawBody($code);

// 检查session key
$sessionKey = $response['session_key'] ?? '';
if (strlen($sessionKey) != 20) {
throw new Exception('sesskon_key错误: ' . $sessionKey, 401900);
$sessionKey = $response['session_key'];
if (empty($sessionKey)) {
throw new Exception('sesskon_key获取失败', 401900);
}
$decodeKey = base64_decode($response['session_key']);
$decodeKey = base64_decode($sessionKey);

// 获取加密结果
$result = openssl_decrypt($decodeEd, 'AES-128-CBC', $decodeKey, 1, $decodeIv);
Expand All @@ -92,7 +92,7 @@ public function get($code)
'nickName' => $data['nickName'],
'sex' => $data['gender'],
'avatarUrl' => $data['avatarUrl'],
'sessionKey' => $response['session_key'],
'sessionKey' => $sessionKey,
];
}

Expand Down

0 comments on commit 30e9a04

Please sign in to comment.