feat: 完善Gemini-Api账户相关的数据统计

This commit is contained in:
shaw
2025-11-23 22:28:26 +08:00
parent bae39d5468
commit 8863075fde
3 changed files with 42 additions and 13 deletions

View File

@@ -5842,16 +5842,32 @@ router.get('/account-usage-trend', authenticateAdmin, async (req, res) => {
})
]
} else if (group === 'gemini') {
const geminiAccounts = await geminiAccountService.getAllAccounts()
accounts = geminiAccounts.map((account) => {
const id = String(account.id || '')
const shortId = id ? id.slice(0, 8) : '未知'
return {
id,
name: account.name || account.email || `Gemini账号 ${shortId}`,
platform: 'gemini'
}
})
const geminiApiAccountService = require('../services/geminiApiAccountService')
const [geminiAccounts, geminiApiAccounts] = await Promise.all([
geminiAccountService.getAllAccounts(),
geminiApiAccountService.getAllAccounts(true)
])
accounts = [
...geminiAccounts.map((account) => {
const id = String(account.id || '')
const shortId = id ? id.slice(0, 8) : '未知'
return {
id,
name: account.name || account.email || `Gemini账号 ${shortId}`,
platform: 'gemini'
}
}),
...geminiApiAccounts.map((account) => {
const id = String(account.id || '')
const shortId = id ? id.slice(0, 8) : '未知'
return {
id,
name: account.name || `Gemini-API账号 ${shortId}`,
platform: 'gemini-api'
}
})
]
} else if (group === 'droid') {
const droidAccounts = await droidAccountService.getAllAccounts()
accounts = droidAccounts.map((account) => {