修复财务仪表盘日明细

This commit is contained in:
yml2213
2026-06-21 09:44:19 +08:00
parent a5165d17e9
commit 5c67f5c411
3 changed files with 42 additions and 6 deletions
@@ -118,8 +118,9 @@ func (r *Repository) dailyItems(ctx context.Context, query DashboardQuery) ([]Fi
itemsByDate[date] = FinanceDailyDTO{Date: date}
}
for _, row := range payments {
item := itemsByDate[row.Date]
item.Date = row.Date
date := dailyDateKey(row.Date)
item := itemsByDate[date]
item.Date = date
item.TotalFlowAmountCent = row.TotalFlowAmountCent
item.TotalRefundAmountCent = row.TotalRefundAmountCent
item.PendingRefundAmountCent = row.PendingRefundAmountCent
@@ -127,17 +128,18 @@ func (r *Repository) dailyItems(ctx context.Context, query DashboardQuery) ([]Fi
item.SuccessfulPayCount = row.SuccessfulPayCount
item.SuccessfulRefundCount = row.SuccessfulRefundCount
item.PendingRefundCount = row.PendingRefundCount
itemsByDate[row.Date] = item
itemsByDate[date] = item
}
for _, row := range settlements {
item := itemsByDate[row.Date]
item.Date = row.Date
date := dailyDateKey(row.Date)
item := itemsByDate[date]
item.Date = date
item.PlatformIncomeAmountCent = row.PlatformIncomeAmountCent
item.OwnerShouldIncomeAmountCent = row.OwnerShouldIncomeAmountCent
item.OwnerWalletIncomeAmountCent = row.OwnerWalletIncomeAmountCent
item.SettlementDiffAmountCent = row.OwnerShouldIncomeAmountCent - row.OwnerWalletIncomeAmountCent
item.SettledOrderCount = row.SettledOrderCount
itemsByDate[row.Date] = item
itemsByDate[date] = item
}
items := make([]FinanceDailyDTO, 0, len(itemsByDate))