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:
@@ -60,6 +60,14 @@ public interface ITransactionRecordRepository : IBaseRepository<TransactionRecor
|
||||
/// <returns>每天的消费笔数和金额</returns>
|
||||
Task<Dictionary<string, (int count, decimal amount)>> GetDailyStatisticsAsync(int year, int month);
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定日期范围内的每日统计
|
||||
/// </summary>
|
||||
/// <param name="startDate">开始日期</param>
|
||||
/// <param name="endDate">结束日期</param>
|
||||
/// <returns>每天的消费笔数和金额</returns>
|
||||
Task<Dictionary<string, (int count, decimal amount)>> GetDailyStatisticsByRangeAsync(DateTime startDate, DateTime endDate);
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定日期范围内的交易记录
|
||||
/// </summary>
|
||||
@@ -342,6 +350,11 @@ public class TransactionRecordRepository(IFreeSql freeSql) : BaseRepository<Tran
|
||||
var startDate = new DateTime(year, month, 1);
|
||||
var endDate = startDate.AddMonths(1);
|
||||
|
||||
return await GetDailyStatisticsByRangeAsync(startDate, endDate);
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, (int count, decimal amount)>> GetDailyStatisticsByRangeAsync(DateTime startDate, DateTime endDate)
|
||||
{
|
||||
var records = await FreeSql.Select<TransactionRecord>()
|
||||
.Where(t => t.OccurredAt >= startDate && t.OccurredAt < endDate)
|
||||
.ToListAsync();
|
||||
|
||||
Reference in New Issue
Block a user