From 2f2e387c0d01093adbf85c9a4914ed4e70b70593 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 30 Oct 2025 15:31:10 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=91=E5=AE=9A=E9=82=80=E8=AF=B7=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E7=8E=B0=E5=9C=A8=E6=97=B6=E9=97=B4=E5=BC=80=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../command/activity/BindInviteCodeExe.java | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/BindInviteCodeExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/BindInviteCodeExe.java index ebd0db01..fe3b0741 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/BindInviteCodeExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/BindInviteCodeExe.java @@ -87,18 +87,28 @@ public class BindInviteCodeExe { throw new RuntimeException("The user does not exist."); } - // 校验用户创建时间是否超过3天 + // 校验用户创建时间是否超过3天 (11月2号0点后生效) Timestamp createTime = userProfile.getCreateTime(); if (createTime != null) { - long createTimeMillis = createTime.getTime(); + // 2025年11月2日 00:00:00 (利雅得时区) + ZonedDateTime effectiveDateTime = ZonedDateTime.of(2025, 11, 2, 0, 0, 0, 0, + ZonedDateTimeAsiaRiyadhUtils.now().getZone()); + long effectiveTime = effectiveDateTime.toInstant().toEpochMilli(); long currentTime = TimestampUtils.now().getTime(); - long threeDaysInMillis = 3 * 24 * 60 * 60 * 1000L; // 3天的毫秒数 - long timeDiff = currentTime - createTimeMillis; - if (timeDiff > threeDaysInMillis) { - log.warn("用户创建时间超过3天,不允许绑定邀请码, userId={}, createTime={}, currentTime={}, diffDays={}", - userId, createTimeMillis, currentTime, timeDiff / (24 * 60 * 60 * 1000L)); - throw new RuntimeException("User registration time has exceeded 3 days and cannot bind invitation code"); + // 只有在11月2号0点后才进行校验 + if (currentTime >= effectiveTime) { + long createTimeMillis = createTime.getTime(); + long threeDaysInMillis = 3 * 24 * 60 * 60 * 1000L; // 3天的毫秒数 + long timeDiff = currentTime - createTimeMillis; + + if (timeDiff > threeDaysInMillis) { + log.warn("用户创建时间超过3天,不允许绑定邀请码, userId={}, createTime={}, currentTime={}, diffDays={}", + userId, createTimeMillis, currentTime, timeDiff / (24 * 60 * 60 * 1000L)); + throw new RuntimeException("User registration time has exceeded 3 days and cannot bind invitation code"); + } + } else { + log.info("当前时间在11月2号0点之前,跳过用户创建时间校验, userId={}, currentTime={}", userId, currentTime); } }