fix: 修复尊享包查询条件并新增时间范围筛选

This commit is contained in:
ccnetcore
2025-11-16 21:32:41 +08:00
parent 4bd2fc357d
commit ffb2f2fb4c

View File

@@ -155,8 +155,10 @@ public class UsageStatisticsService : ApplicationService, IUsageStatisticsServic
// 获取尊享包Token信息 // 获取尊享包Token信息
var entities = await _premiumPackageRepository._DbQueryable var entities = await _premiumPackageRepository._DbQueryable
.Where(x => x.UserId == userId) .Where(x => x.UserId == userId)
.WhereIF(input.IsFree == true, x => x.PurchaseAmount > 0) .WhereIF(input.IsFree == false, x => x.PurchaseAmount > 0)
.WhereIF(input.IsFree == false, x => x.PurchaseAmount == 0) .WhereIF(input.IsFree == true, x => x.PurchaseAmount == 0)
.WhereIF(input.StartTime is not null && input.EndTime is not null,
x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
.OrderByDescending(x => x.CreationTime) .OrderByDescending(x => x.CreationTime)
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total); .ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
return new PagedResultDto<PremiumTokenUsageGetListOutput>(total, return new PagedResultDto<PremiumTokenUsageGetListOutput>(total,