邀请活动有效期改为7天
This commit is contained in:
parent
4d0cb9aea3
commit
4f6f296f6a
@ -87,29 +87,17 @@ public class BindInviteCodeExe {
|
|||||||
throw new RuntimeException("The user does not exist.");
|
throw new RuntimeException("The user does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验用户创建时间是否超过3天 (11月2号0点后生效)
|
// 校验用户创建时间是否超过7天 (11月2号0点后生效)
|
||||||
Timestamp createTime = userProfile.getCreateTime();
|
Timestamp createTime = userProfile.getCreateTime();
|
||||||
if (createTime != null) {
|
if (createTime == null) {
|
||||||
// 2025年11月2日 00:00:00 (利雅得时区)
|
throw new RuntimeException("The user createTime does not exist.");
|
||||||
ZonedDateTime effectiveDateTime = ZonedDateTime.of(2025, 11, 2, 0, 0, 0, 0,
|
}
|
||||||
ZonedDateTimeAsiaRiyadhUtils.now().getZone());
|
|
||||||
long effectiveTime = effectiveDateTime.toInstant().toEpochMilli();
|
|
||||||
long currentTime = TimestampUtils.now().getTime();
|
|
||||||
|
|
||||||
// 只有在11月2号0点后才进行校验
|
long threeDaysInMillis = 7 * 24 * 60 * 60 * 1000L; // 7天的毫秒数
|
||||||
if (currentTime >= effectiveTime) {
|
long timeDiff = TimestampUtils.now().getTime() - createTime.getTime();
|
||||||
long createTimeMillis = createTime.getTime();
|
|
||||||
long threeDaysInMillis = 3 * 24 * 60 * 60 * 1000L; // 3天的毫秒数
|
|
||||||
long timeDiff = currentTime - createTimeMillis;
|
|
||||||
|
|
||||||
if (timeDiff > threeDaysInMillis) {
|
if (timeDiff > threeDaysInMillis) {
|
||||||
log.warn("用户创建时间超过3天,不允许绑定邀请码, userId={}, createTime={}, currentTime={}, diffDays={}",
|
throw new RuntimeException("User registration time has exceeded 3 days and cannot bind invitation code");
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 校验是否已绑定过邀请人(userId=邀请人, inviteUserId=被邀请人)
|
// 4. 校验是否已绑定过邀请人(userId=邀请人, inviteUserId=被邀请人)
|
||||||
|
|||||||
@ -43,12 +43,12 @@ public class MyInviterInfoQryExe {
|
|||||||
userBasicInfoCO.setAvatar(currentUser.getUserAvatar());
|
userBasicInfoCO.setAvatar(currentUser.getUserAvatar());
|
||||||
userBasicInfoCO.setCreateTime(currentUser.getCreateTime());
|
userBasicInfoCO.setCreateTime(currentUser.getCreateTime());
|
||||||
|
|
||||||
// 校验用户创建时间是否超过3天
|
// 校验用户创建时间是否超过7天
|
||||||
Timestamp createTime = currentUser.getCreateTime();
|
Timestamp createTime = currentUser.getCreateTime();
|
||||||
if (createTime != null) {
|
if (createTime != null) {
|
||||||
long createTimeMillis = createTime.getTime();
|
long createTimeMillis = createTime.getTime();
|
||||||
long currentTime = TimestampUtils.now().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;
|
long timeDiff = currentTime - createTimeMillis;
|
||||||
|
|
||||||
if (timeDiff > threeDaysInMillis) {
|
if (timeDiff > threeDaysInMillis) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user