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); }