🐛 Fix subscription status wrong

This commit is contained in:
2025-08-09 21:34:30 +08:00
parent 14a5c01a6d
commit 4bceb119ea

View File

@@ -424,8 +424,11 @@ public class SubscriptionService(
} }
// If not in cache, get from database // If not in cache, get from database
var now = SystemClock.Instance.GetCurrentInstant();
var subscription = await db.WalletSubscriptions var subscription = await db.WalletSubscriptions
.Where(s => s.AccountId == accountId && PerkIdentifiers.Contains(s.Identifier)) .Where(s => s.AccountId == accountId && PerkIdentifiers.Contains(s.Identifier))
.Where(s => s.Status == SubscriptionStatus.Active)
.Where(s => s.EndedAt == null || s.EndedAt > now)
.OrderByDescending(s => s.BegunAt) .OrderByDescending(s => s.BegunAt)
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();