diff --git a/webapp/controller/KefuController.class.php b/webapp/controller/KefuController.class.php index 9fa147d..6687799 100644 --- a/webapp/controller/KefuController.class.php +++ b/webapp/controller/KefuController.class.php @@ -320,12 +320,12 @@ class KefuController { private function getAccessToken($accountid) { - $r = $this->getRedis($accountid); - $access_token = $r->get('kf_token:' . $accountid . ':'); + $gameid = phpcommon\extractGameId($accountid); + $r = $this->getRedis($gameid); + $access_token = $r->get('kf_token:' . $gameid . ':'); if (!empty($access_token)) { return $access_token; } - $gameid = phpcommon\extractGameId($accountid); $config_name = "../config/game$gameid/weixin/config.php"; @require $config_name; @@ -342,8 +342,8 @@ class KefuController { } $respobj = json_decode($response, true); if (isset($respobj['access_token'])) { - $r->set('kf_token:' . $accountid . ':', $respobj['access_token']); - $r->pexpire('kf_token:' . $accountid . ':', 1000 * ($respobj['expires_in'] - 60 * 1)); + $r->set('kf_token:' . $gameid . ':', $respobj['access_token']); + $r->pexpire('kf_token:' . $gameid . ':', 1000 * ($respobj['expires_in'] - 60 * 1)); return $respobj['access_token']; } else { return '';