diff --git a/internal/service/package/activation_service.go b/internal/service/package/activation_service.go index 0385588..bff087e 100644 --- a/internal/service/package/activation_service.go +++ b/internal/service/package/activation_service.go @@ -113,8 +113,14 @@ func (s *ActivationService) ActivateByRealname(ctx context.Context, carrierType } } - // 激活套餐 - activatedAt := now + // REALNAME-04: 按 ExpiryBase 选择激活计时基准 + // from_purchase:购买时起算,用 PackageUsage 创建时间;否则用实名触发当前时刻 + var activatedAt time.Time + if pkg.ExpiryBase == "from_purchase" { + activatedAt = usage.CreatedAt + } else { + activatedAt = now + } expiresAt := CalculateExpiryTime(pkg.CalendarType, activatedAt, pkg.DurationMonths, pkg.DurationDays) // 计算下次重置时间