fix
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 31s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s

This commit is contained in:
2026-02-01 10:27:04 +08:00
parent 704f58b1a1
commit 61916dc6da
7 changed files with 810 additions and 310 deletions

View File

@@ -32,8 +32,22 @@ public class TransactionStatisticsService(
{
public async Task<Dictionary<string, (int count, decimal expense, decimal income, decimal saving)>> GetDailyStatisticsAsync(int year, int month, string? savingClassify = null)
{
var startDate = new DateTime(year, month, 1);
var endDate = startDate.AddMonths(1);
// 当 month=0 时,表示查询整年数据
DateTime startDate;
DateTime endDate;
if (month == 0)
{
// 查询整年1月1日至12月31日
startDate = new DateTime(year, 1, 1);
endDate = new DateTime(year, 12, 31).AddDays(1); // 包含12月31日
}
else
{
// 查询指定月份
startDate = new DateTime(year, month, 1);
endDate = startDate.AddMonths(1);
}
return await GetDailyStatisticsByRangeAsync(startDate, endDate, savingClassify);
}