快照获取退款规则

This commit is contained in:
马梓彭 2026-05-15 17:09:50 +08:00
parent 5bb4bd2d00
commit 81f516300e

View File

@ -2966,17 +2966,17 @@ public class UnifiedRegistrationService : ITransient
output.ProjectDetails.Add(projectDetail); output.ProjectDetails.Add(projectDetail);
} }
var refundConfigs = await _refundConfigService.GetList(); // 从快照获取退款规则
refundConfigs = refundConfigs.Where(x => x.Status == Core.Enum.AvailabilityStatus.Enable).OrderBy(x => x.DayStart).ToList(); var refundSnapshots = await _ruleSnapshotService.GetRefundRuleSnapshot(eventInfo.Id);
foreach (var config in refundConfigs) foreach (var snapshot in refundSnapshots)
{ {
output.RefundRules.Add(new RefundRuleDto output.RefundRules.Add(new RefundRuleDto
{ {
DayStart = config.DayStart, DayStart = snapshot.DayStart,
DayEnd = config.DayEnd, DayEnd = snapshot.DayEnd,
DeductPercentage = config.DeductPercentage, DeductPercentage = snapshot.DeductPercentage,
Remark = config.Remark Remark = snapshot.Remark
}); });
} }
@ -2989,7 +2989,7 @@ public class UnifiedRegistrationService : ITransient
} }
else else
{ {
var matchConfig = refundConfigs.FirstOrDefault(c => var matchConfig = refundSnapshots.FirstOrDefault(c =>
daysRemaining >= c.DayStart && daysRemaining >= c.DayStart &&
(c.DayEnd == int.MaxValue ? true : daysRemaining < c.DayEnd) (c.DayEnd == int.MaxValue ? true : daysRemaining < c.DayEnd)
); );