From 4f6f296f6a48cb8aed8bd2635e32fd1ab8c7a80d Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Fri, 5 Dec 2025 14:36:00 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=80=E8=AF=B7=E6=B4=BB=E5=8A=A8=E6=9C=89?= =?UTF-8?q?=E6=95=88=E6=9C=9F=E6=94=B9=E4=B8=BA7=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../command/activity/BindInviteCodeExe.java | 28 ++++++------------- .../activity/query/MyInviterInfoQryExe.java | 4 +-- 2 files changed, 10 insertions(+), 22 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 e9ef5978..d3d1796a 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,29 +87,17 @@ public class BindInviteCodeExe { throw new RuntimeException("The user does not exist."); } - // 校验用户创建时间是否超过3天 (11月2号0点后生效) + // 校验用户创建时间是否超过7天 (11月2号0点后生效) Timestamp createTime = userProfile.getCreateTime(); - if (createTime != null) { - // 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(); + if (createTime == null) { + throw new RuntimeException("The user createTime does not exist."); + } - // 只有在11月2号0点后才进行校验 - if (currentTime >= effectiveTime) { - long createTimeMillis = createTime.getTime(); - long threeDaysInMillis = 3 * 24 * 60 * 60 * 1000L; // 3天的毫秒数 - long timeDiff = currentTime - createTimeMillis; + long threeDaysInMillis = 7 * 24 * 60 * 60 * 1000L; // 7天的毫秒数 + long timeDiff = TimestampUtils.now().getTime() - createTime.getTime(); - 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); - } + if (timeDiff > threeDaysInMillis) { + throw new RuntimeException("User registration time has exceeded 3 days and cannot bind invitation code"); } // 4. 校验是否已绑定过邀请人(userId=邀请人, inviteUserId=被邀请人) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/MyInviterInfoQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/MyInviterInfoQryExe.java index ffaa96f4..8ef39ec0 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/MyInviterInfoQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/MyInviterInfoQryExe.java @@ -43,12 +43,12 @@ public class MyInviterInfoQryExe { userBasicInfoCO.setAvatar(currentUser.getUserAvatar()); userBasicInfoCO.setCreateTime(currentUser.getCreateTime()); - // 校验用户创建时间是否超过3天 + // 校验用户创建时间是否超过7天 Timestamp createTime = currentUser.getCreateTime(); if (createTime != null) { long createTimeMillis = createTime.getTime(); long currentTime = TimestampUtils.now().getTime(); - long threeDaysInMillis = 3 * 24 * 60 * 60 * 1000L; // 3天的毫秒数 + long threeDaysInMillis = 7 * 24 * 60 * 60 * 1000L; // 7天的毫秒数 long timeDiff = currentTime - createTimeMillis; if (timeDiff > threeDaysInMillis) {