仪表盘功能完善

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
@@ -14,6 +14,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 管理员控制器
@@ -143,4 +144,26 @@ public class AdminController {
DashboardStatsResponse.SystemStats systemStats = dashboardService.getSystemStats();
return Result.success("获取成功", systemStats);
}
/**
* 获取用户增长趋势数据
*/
@Operation(summary = "获取用户增长趋势数据", description = "获取指定天数的用户增长趋势数据")
@GetMapping("/dashboard/user-growth-trends")
public Result<List<DashboardStatsResponse.UserGrowthTrend>> getUserGrowthTrends(
@RequestParam(defaultValue = "7") int days) {
List<DashboardStatsResponse.UserGrowthTrend> trends = dashboardService.getUserGrowthTrends(days);
return Result.success("获取成功", trends);
}
/**
* 获取最近登录用户
*/
@Operation(summary = "获取最近登录用户", description = "获取最近登录的用户列表")
@GetMapping("/dashboard/recent-logins")
public Result<List<DashboardStatsResponse.RecentLogin>> getRecentLogins(
@RequestParam(defaultValue = "10") int limit) {
List<DashboardStatsResponse.RecentLogin> recentLogins = dashboardService.getRecentLogins(limit);
return Result.success("获取成功", recentLogins);
}
}