仪表盘功能完善

This commit is contained in:
2025-10-31 14:33:57 +08:00
parent 778f05daa5
commit bbe79ecffb
8 changed files with 416 additions and 20 deletions
+39
View File
@@ -41,12 +41,29 @@ export interface RecentActivity {
extraData: Record<string, any>
}
export interface UserGrowthTrend {
date: string
newUsers: number
totalUsers: number
}
export interface RecentLogin {
userId: string
username: string
nickname: string
avatar: string
loginTime: string
timeDescription: string
}
export interface DashboardStats {
userStats: UserStats
contentStats: ContentStats
aiServiceStats: AiServiceStats
systemStats: SystemStats
recentActivities: RecentActivity[]
userGrowthTrends: UserGrowthTrend[]
recentLogins: RecentLogin[]
updateTime: string
}
@@ -98,4 +115,26 @@ export function getSystemStats() {
url: '/admin/dashboard/system-stats',
method: 'get'
})
}
/**
* 获取用户增长趋势数据
*/
export function getUserGrowthTrends(days: number = 7) {
return request<UserGrowthTrend[]>({
url: '/admin/dashboard/user-growth-trends',
method: 'get',
params: { days }
})
}
/**
* 获取最近登录用户
*/
export function getRecentLogins(limit: number = 10) {
return request<RecentLogin[]>({
url: '/admin/dashboard/recent-logins',
method: 'get',
params: { limit }
})
}