feat: 添加用户记账连击(streak)功能,包括服务、处理器、模型和仓库层。

This commit is contained in:
2026-01-28 10:32:05 +08:00
parent e811256d99
commit 0d21b9444e
4 changed files with 81 additions and 0 deletions

View File

@@ -241,3 +241,11 @@ func (s *StreakService) CheckAndResetStreak(userID uint) error {
return nil
}
// GetContributionData returns daily transaction counts for the past year
func (s *StreakService) GetContributionData(userID uint) ([]models.DailyContribution, error) {
now := time.Now()
startDate := now.AddDate(-1, 0, 0) // 1 year ago
return s.repo.GetDailyContribution(userID, startDate, now)
}