mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 00:53:33 +00:00
refactor: 优化API Key状态过滤逻辑,增强代码可读性
This commit is contained in:
@@ -3111,7 +3111,7 @@ const getDroidApiKeyCount = (account) => {
|
||||
// 优先使用 apiKeys 数组来计算正常状态的 API Keys
|
||||
if (Array.isArray(account.apiKeys)) {
|
||||
// 只计算状态不是 'error' 的 API Keys
|
||||
return account.apiKeys.filter(apiKey => apiKey.status !== 'error').length
|
||||
return account.apiKeys.filter((apiKey) => apiKey.status !== 'error').length
|
||||
}
|
||||
|
||||
// 如果是字符串格式的 apiKeys,尝试解析
|
||||
@@ -3120,7 +3120,7 @@ const getDroidApiKeyCount = (account) => {
|
||||
const parsed = JSON.parse(account.apiKeys)
|
||||
if (Array.isArray(parsed)) {
|
||||
// 只计算状态不是 'error' 的 API Keys
|
||||
return parsed.filter(apiKey => apiKey.status !== 'error').length
|
||||
return parsed.filter((apiKey) => apiKey.status !== 'error').length
|
||||
}
|
||||
} catch (error) {
|
||||
// 忽略解析错误,继续使用其他字段
|
||||
|
||||
Reference in New Issue
Block a user