This commit is contained in:
aozhiwei 2019-01-29 16:30:59 +08:00
parent 60800a4d49
commit cefc3f36d0

View File

@ -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 '';