mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 21:17:30 +00:00
Revert: 撤销 584fa8c 之后的所有提交
This commit is contained in:
@@ -79,8 +79,7 @@ router.get('/api-keys/:keyId/cost-debug', authenticateAdmin, async (req, res) =>
|
||||
const costStats = await redis.getCostStats(keyId)
|
||||
const dailyCost = await redis.getDailyCost(keyId)
|
||||
const today = redis.getDateStringInTimezone()
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const _client = redis.getClientSafe()
|
||||
const client = redis.getClientSafe()
|
||||
|
||||
// 获取所有相关的Redis键
|
||||
const costKeys = await redis.scanKeys(`usage:cost:*:${keyId}:*`)
|
||||
@@ -290,18 +289,20 @@ router.get('/api-keys', authenticateAdmin, async (req, res) => {
|
||||
}
|
||||
|
||||
// 为每个API Key添加owner的displayName(批量获取优化)
|
||||
const userIdsToFetch = [...new Set(result.items.filter((k) => k.userId).map((k) => k.userId))]
|
||||
const userIdsToFetch = [
|
||||
...new Set(result.items.filter((k) => k.userId).map((k) => k.userId))
|
||||
]
|
||||
const userMap = new Map()
|
||||
|
||||
if (userIdsToFetch.length > 0) {
|
||||
// 批量获取用户信息
|
||||
const users = await Promise.all(
|
||||
userIdsToFetch.map((id) => userService.getUserById(id, false).catch(() => null))
|
||||
userIdsToFetch.map((id) =>
|
||||
userService.getUserById(id, false).catch(() => null)
|
||||
)
|
||||
)
|
||||
userIdsToFetch.forEach((id, i) => {
|
||||
if (users[i]) {
|
||||
userMap.set(id, users[i])
|
||||
}
|
||||
if (users[i]) userMap.set(id, users[i])
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user