From 60b43bb29e13129e2d3a284899b5a5712d4c01af Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 28 Mar 2026 10:39:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(realname):=20ActivateByRealname=20=E6=8C=89?= =?UTF-8?q?=20ExpiryBase=20=E9=80=89=E6=8B=A9=E8=AE=A1=E6=97=B6=E5=9F=BA?= =?UTF-8?q?=E5=87=86=20REALNAME-04?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - from_purchase:用 PackageUsage.CreatedAt(购买时刻)作为激活时间起点 - from_activation(默认):用实名被触发的当前时刻作为激活时间起点 --- internal/service/package/activation_service.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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) // 计算下次重置时间