Skip to content

Commit

Permalink
1.修复一个小bug,(该bug不影响功能正常使用)
Browse files Browse the repository at this point in the history
  • Loading branch information
shinn-lancelot committed Jul 16, 2018
1 parent 69fc773 commit b5c2070
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
} else if ($proxyScope == 'access_token') {
$cacheDir = __DIR__ . '/Cache/appid_' . $appId;
session_start();
$openid = $_SESSION['openid'];
$openid = $_SESSION['openid_' . $appId];
$res = json_decode(file_get_contents($cacheDir . '/access_token_openid_' . $openid . '.json'), true);
// access_token缓存文件不存在或者access_token已过期或者openid已过期,则重新获取
if (!$res || $res['expire_time'] <= time() || empty($openid)) {
Expand All @@ -66,7 +66,7 @@
$res['expire_time'] = time() + $res['expires_in'];
// 处理openid
$openid = $res['openid'];
$_SESSION['openid'] = $res['openid'];
$_SESSION['openid_' . $appId] = $res['openid'];
unset($res['openid']);
// 缓存access_token等数据
file_put_contents($cacheDir . '/access_token_openid_' . $openid . '.json', json_encode($res));
Expand All @@ -93,7 +93,7 @@
$res['expire_time'] = time() + $res['expires_in'];
// 处理openid
$openid = $res['openid'];
$_SESSION['openid'] = $res['openid'];
$_SESSION['openid_' . $appId] = $res['openid'];
unset($res['openid']);
// 缓存access_token等数据
file_put_contents($cacheDir . '/access_token_openid_' . $openid . '.json', json_encode($res));
Expand Down

0 comments on commit b5c2070

Please sign in to comment.