feat: 账号使用趋势增加对Droid账户的支持

This commit is contained in:
AAEE86
2025-10-16 22:54:17 +08:00
parent 28b709d30b
commit 8f58fe6264
2 changed files with 16 additions and 3 deletions

View File

@@ -5736,7 +5736,7 @@ router.get('/account-usage-trend', authenticateAdmin, async (req, res) => {
try {
const { granularity = 'day', group = 'claude', days = 7, startDate, endDate } = req.query
const allowedGroups = ['claude', 'openai', 'gemini']
const allowedGroups = ['claude', 'openai', 'gemini', 'droid']
if (!allowedGroups.includes(group)) {
return res.status(400).json({
success: false,
@@ -5747,7 +5747,8 @@ router.get('/account-usage-trend', authenticateAdmin, async (req, res) => {
const groupLabels = {
claude: 'Claude账户',
openai: 'OpenAI账户',
gemini: 'Gemini账户'
gemini: 'Gemini账户',
droid: 'Droid账户'
}
// 拉取各平台账号列表
@@ -5815,6 +5816,17 @@ router.get('/account-usage-trend', authenticateAdmin, async (req, res) => {
platform: 'gemini'
}
})
} else if (group === 'droid') {
const droidAccounts = await droidAccountService.getAllAccounts()
accounts = droidAccounts.map((account) => {
const id = String(account.id || '')
const shortId = id ? id.slice(0, 8) : '未知'
return {
id,
name: account.name || account.ownerEmail || account.ownerName || `Droid账号 ${shortId}`,
platform: 'droid'
}
})
}
if (!accounts || accounts.length === 0) {

View File

@@ -726,7 +726,8 @@ let accountUsageTrendChartInstance = null
const accountGroupOptions = [
{ value: 'claude', label: 'Claude' },
{ value: 'openai', label: 'OpenAI' },
{ value: 'gemini', label: 'Gemini' }
{ value: 'gemini', label: 'Gemini' },
{ value: 'droid', label: 'Droid' }
]
const accountTrendUpdating = ref(false)