feat(日历): 添加交易热力图组件展示每日交易统计
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 25s
Docker Build & Deploy / Deploy to Production (push) Successful in 10s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 2s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 25s
Docker Build & Deploy / Deploy to Production (push) Successful in 10s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 2s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s
- 新增 ContributionHeatmap 组件实现类似 GitHub 贡献热力图的可视化 - 添加 getDailyStatisticsRange API 接口获取日期范围内的每日统计数据 - 调整日历页面布局以容纳热力图组件 - 热力图支持动态阈值计算和暗黑模式适配 - 交易变更时自动刷新热力图数据
This commit is contained in:
@@ -284,6 +284,33 @@ public class TransactionRecordController(
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定日期范围内的每日统计
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<DailyStatisticsDto>>> GetDailyStatisticsRangeAsync(
|
||||
[FromQuery] DateTime startDate,
|
||||
[FromQuery] DateTime endDate
|
||||
)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 确保包含结束日期当天
|
||||
var effectiveEndDate = endDate.Date.AddDays(1);
|
||||
var effectiveStartDate = startDate.Date;
|
||||
|
||||
var statistics = await transactionRepository.GetDailyStatisticsByRangeAsync(effectiveStartDate, effectiveEndDate);
|
||||
var result = statistics.Select(s => new DailyStatisticsDto(s.Key, s.Value.count, s.Value.amount)).ToList();
|
||||
|
||||
return result.Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "获取日历统计数据失败,开始: {StartDate}, 结束: {EndDate}", startDate, endDate);
|
||||
return $"获取日历统计数据失败: {ex.Message}".Fail<List<DailyStatisticsDto>>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取月度统计数据
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user