From bb225cfd00cf4cc6ad9383dbb99c9992c4c630e4 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Fri, 6 Mar 2026 17:32:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=80=E8=AF=B7=E8=80=85=E3=80=81=E8=A2=AB?= =?UTF-8?q?=E9=82=80=E8=AF=B7=E8=80=85=E7=9A=84=E5=A5=96=E5=8A=B1=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E7=BB=91=E5=AE=9A=E5=90=8E=E7=9A=84?= =?UTF-8?q?7=E5=A4=A9=E5=86=85=E5=85=85=E5=80=BC=E7=B4=AF=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../circle/other/app/listener/task/TaskListener.java | 11 +++++++++++ .../infra/gateway/user/InviteUserGatewayImpl.java | 10 ++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/task/TaskListener.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/task/TaskListener.java index 97ca85e4..ffd3bd82 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/task/TaskListener.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/task/TaskListener.java @@ -49,6 +49,7 @@ import org.apache.commons.lang3.StringUtils; import java.math.BigDecimal; import java.sql.Timestamp; import java.time.Duration; +import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZonedDateTime; import java.util.List; @@ -393,6 +394,10 @@ public class TaskListener implements MessageListener { } UserInviteUser userInviteUser = allInvites.get(0); + if (!isNewUserWithinDays(userInviteUser, 7)) { + return; + } + // 金币奖励发给邀请人A 500 long gold = 500; walletGoldClient.changeBalance(GoldReceiptCmd.builder() @@ -424,6 +429,12 @@ public class TaskListener implements MessageListener { } + /** 判断绑定时间是否为N天内 */ + private boolean isNewUserWithinDays(UserInviteUser userInviteUser, int days) { + Duration duration = Duration.between(userInviteUser.getCreateTime().toLocalDateTime(), LocalDateTime.now()); + return duration.toDays() < days; + } + private void recordRanking(Long userId, Long quantity) { RankingActivityRecord record = new RankingActivityRecord(); record.setSysOrigin(SysOriginPlatformEnum.LIKEI.name()); diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/InviteUserGatewayImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/InviteUserGatewayImpl.java index 351051bc..e8ed43a7 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/InviteUserGatewayImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/InviteUserGatewayImpl.java @@ -54,7 +54,6 @@ public class InviteUserGatewayImpl implements InviteUserGateway { private final UserInviteCacheService userInviteCacheService; private final InviteUserSummaryService inviteUserSummaryService; private final UserInviteUserDAO userInviteUserDAO; - private final UserProfileGateway userProfileGateway; private final InviteUserRechargeCommissionService inviteUserRechargeCommissionService; private final RankingActivityGateway rankingActivityGateway; private final RedisService redisService; @@ -121,7 +120,7 @@ public class InviteUserGatewayImpl implements InviteUserGateway { result.setInviteeUserId(inviteUserId); result.setInviteeTotalRecharge(totalRecharge); result.setSysOrigin(sysOrigin); - result.setNewUser(isNewUserWithinDays(inviteUserId, 7)); + result.setNewUser(isNewUserWithinDays(userInviteUser, 7)); return result; } @@ -177,10 +176,9 @@ public class InviteUserGatewayImpl implements InviteUserGateway { return userInviteCacheService.getCommissionRate(SysOriginPlatformEnum.valueOf(sysOrigin)); } - /** 判断用户是否为注册N天内的新用户 */ - private boolean isNewUserWithinDays(Long userId, int days) { - UserProfile userProfile = userProfileGateway.getByUserId(userId); - Duration duration = Duration.between(userProfile.getCreateTime().toLocalDateTime(), LocalDateTime.now()); + /** 判断绑定时间是否为N天内 */ + private boolean isNewUserWithinDays(UserInviteUser userInviteUser, int days) { + Duration duration = Duration.between(userInviteUser.getCreateTime().toLocalDateTime(), LocalDateTime.now()); return duration.toDays() < days; }