fix: 修复剩余令牌统计逻辑,增加过期时间判断

This commit is contained in:
ccnetcore
2025-10-13 22:09:47 +08:00
parent bdc664fc44
commit 16945b3d5b

View File

@@ -133,7 +133,8 @@ public class PremiumPackageManager : DomainService
{
return await _premiumPackageRepository._DbQueryable
.Where(x => x.UserId == userId && x.IsActive && x.RemainingTokens > 0)
.Where(p => p.IsAvailable())
.Where(p => p.IsActive)
.Where(p => !p.ExpireDateTime.HasValue || p.ExpireDateTime.Value >= DateTime.Now)
.SumAsync(p => p.RemainingTokens);
}