1
This commit is contained in:
parent
60800a4d49
commit
cefc3f36d0
@ -320,12 +320,12 @@ class KefuController {
|
|||||||
|
|
||||||
private function getAccessToken($accountid)
|
private function getAccessToken($accountid)
|
||||||
{
|
{
|
||||||
$r = $this->getRedis($accountid);
|
$gameid = phpcommon\extractGameId($accountid);
|
||||||
$access_token = $r->get('kf_token:' . $accountid . ':');
|
$r = $this->getRedis($gameid);
|
||||||
|
$access_token = $r->get('kf_token:' . $gameid . ':');
|
||||||
if (!empty($access_token)) {
|
if (!empty($access_token)) {
|
||||||
return $access_token;
|
return $access_token;
|
||||||
}
|
}
|
||||||
$gameid = phpcommon\extractGameId($accountid);
|
|
||||||
$config_name = "../config/game$gameid/weixin/config.php";
|
$config_name = "../config/game$gameid/weixin/config.php";
|
||||||
@require $config_name;
|
@require $config_name;
|
||||||
|
|
||||||
@ -342,8 +342,8 @@ class KefuController {
|
|||||||
}
|
}
|
||||||
$respobj = json_decode($response, true);
|
$respobj = json_decode($response, true);
|
||||||
if (isset($respobj['access_token'])) {
|
if (isset($respobj['access_token'])) {
|
||||||
$r->set('kf_token:' . $accountid . ':', $respobj['access_token']);
|
$r->set('kf_token:' . $gameid . ':', $respobj['access_token']);
|
||||||
$r->pexpire('kf_token:' . $accountid . ':', 1000 * ($respobj['expires_in'] - 60 * 1));
|
$r->pexpire('kf_token:' . $gameid . ':', 1000 * ($respobj['expires_in'] - 60 * 1));
|
||||||
return $respobj['access_token'];
|
return $respobj['access_token'];
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user