From 8e55004d3f8f3c31daceb78639346a22ba2e4f92 Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Wed, 27 Apr 2022 11:42:29 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=A8=8B=E5=BA=8F=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E3=80=91token=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/crmeb/utils/JwtAuth.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crmeb/crmeb/utils/JwtAuth.php b/crmeb/crmeb/utils/JwtAuth.php index 108e2512e..26054cf73 100644 --- a/crmeb/crmeb/utils/JwtAuth.php +++ b/crmeb/crmeb/utils/JwtAuth.php @@ -95,7 +95,12 @@ class JwtAuth { $tokenInfo = $this->getToken($id, $type, $params); $exp = $tokenInfo['params']['exp'] - $tokenInfo['params']['iat'] + 60; - $res = CacheService::setTokenBucket(md5($tokenInfo['token']), ['uid' => $id, 'type' => $type, 'token' => $tokenInfo['token'], 'exp' => $exp], (int)$exp); + if (in_array($type, ['api', 'wechat', 'routine'])) { + $type = 'api' . $id; + } else { + $type = 'admin'; + } + $res = CacheService::setTokenBucket(md5($tokenInfo['token']), ['uid' => $id, 'type' => $type, 'token' => $tokenInfo['token'], 'exp' => $exp], (int)$exp, $type); if (!$res) { throw new AdminException(ApiErrorCode::ERR_SAVE_TOKEN); }