From 341ac90455b88d3a6e0482ce8cc5181e634171f5 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Fri, 27 Feb 2026 11:54:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=8C=87=E7=BA=B9=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E4=BD=8D=E7=BD=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../other/app/command/activity/BindInviteCodeExe.java | 10 +++------- .../command/activity/ClaimActivityRewardBadgeExe.java | 5 +++-- .../app/command/activity/ClaimActivityRewardExe.java | 5 +++-- .../other/app/command/activity/LotteryDrawExe.java | 7 ++++--- .../app/command/activity/LotteryMultiDrawExe.java | 7 ++++--- .../gateway/user/ability/RegisterDeviceGateway.java | 9 +++++++++ .../infra/gateway/user/RegisterDeviceGatewayImpl.java | 7 +++++++ 7 files changed, 33 insertions(+), 17 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 d3d1796a..24947ae2 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 @@ -1,20 +1,17 @@ package com.red.circle.other.app.command.activity; import com.red.circle.component.redis.service.RedisService; -import com.red.circle.framework.dto.ResultResponse; import com.red.circle.mq.business.model.event.task.TaskApprovalEvent; import com.red.circle.mq.rocket.business.producer.TaskMqMessage; import com.red.circle.other.app.command.user.InviteCodeService; -import com.red.circle.other.app.dto.cmd.SpinsTaskProgressUpdateCmd; import com.red.circle.other.app.dto.cmd.activity.BindInviteCodeCmd; import com.red.circle.other.app.service.SpinsUserTaskProgressService; import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.gateway.user.ability.RegisterDeviceGateway; import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.infra.database.rds.entity.user.user.UserInviteUser; import com.red.circle.other.infra.database.rds.service.user.user.UserInviteUserService; import com.red.circle.other.infra.enums.user.InviteTypeEnum; -import com.red.circle.other.inner.endpoint.user.device.RegisterDeviceClient; -import com.red.circle.tool.core.date.LocalDateTimeUtils; import com.red.circle.tool.core.date.TimestampUtils; import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils; import com.red.circle.tool.core.sequence.IdWorkerUtils; @@ -46,7 +43,7 @@ public class BindInviteCodeExe { private final InviteCodeService inviteCodeService; private final RedisService redisService; private final SpinsUserTaskProgressService spinsUserTaskProgressService; - private final RegisterDeviceClient registerDeviceClient; + private final RegisterDeviceGateway registerDeviceGateway; private final TaskMqMessage taskMqMessage; /** @@ -200,8 +197,7 @@ public class BindInviteCodeExe { */ private String getDeviceId(Long userId) { try { - ResultResponse response = registerDeviceClient.getDeviceFingerprintByUserId(userId); - String fingerprint = response != null && response.getStatus() ? response.getBody() : null; + String fingerprint = registerDeviceGateway.getDeviceFingerprintByUserId(userId); if (StringUtils.isNotBlank(fingerprint)) { log.info("获取到设备指纹, userId={}, fingerprint={}", userId, fingerprint); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardBadgeExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardBadgeExe.java index 817abe3d..63f55b3c 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardBadgeExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardBadgeExe.java @@ -10,6 +10,7 @@ import com.red.circle.other.app.dto.clientobject.activity.MyTotalDrawCountCO; import com.red.circle.other.app.dto.cmd.activity.ClaimActivityRewardCmd; import com.red.circle.other.app.service.activity.LotteryActivityRestService; import com.red.circle.other.domain.gateway.props.ActivitySourceGroupGateway; +import com.red.circle.other.domain.gateway.user.ability.RegisterDeviceGateway; import com.red.circle.other.infra.database.rds.dao.activity.UserActivityRewardClaimDAO; import com.red.circle.other.infra.database.rds.entity.activity.LotteryDeviceRecord; import com.red.circle.other.infra.database.rds.entity.activity.UserActivityRewardClaim; @@ -52,7 +53,7 @@ public class ClaimActivityRewardBadgeExe { private final UserActivityRechargeService userActivityRechargeService; private final UserActivityRewardClaimDAO userActivityRewardClaimDAO; private final LotteryTicketClient lotteryTicketClient; - private final LatestMobileDeviceService latestMobileDeviceService; + private final RegisterDeviceGateway registerDeviceGateway; private final LotteryDeviceRecordService lotteryDeviceRecordService; private final LotteryActivityRestService lotteryActivityRestService; private final BadgeBackpackClient badgeBackpackClient; @@ -129,7 +130,7 @@ public class ClaimActivityRewardBadgeExe { * 校验设备唯一性(防止小号薅羊毛) */ private void checkDeviceUnique(Long activityId, Long userId) { - String fingerprint = latestMobileDeviceService.getEnhancedDeviceFingerprintByUserId(userId); + String fingerprint = registerDeviceGateway.getEnhancedDeviceFingerprintByUserId(userId); if (com.red.circle.tool.core.text.StringUtils.isBlank(fingerprint)) { log.warn("Failed to get device fingerprint, userId: {}", userId); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardExe.java index f59d1e14..47f884d7 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardExe.java @@ -9,6 +9,7 @@ import com.red.circle.framework.core.response.CommonErrorCode; import com.red.circle.other.app.dto.clientobject.activity.ClaimRewardResultCO; import com.red.circle.other.app.dto.cmd.activity.ClaimActivityRewardCmd; import com.red.circle.other.domain.gateway.props.ActivitySourceGroupGateway; +import com.red.circle.other.domain.gateway.user.ability.RegisterDeviceGateway; import com.red.circle.other.infra.database.rds.dao.activity.UserActivityRewardClaimDAO; import com.red.circle.other.infra.database.rds.entity.activity.LotteryDeviceRecord; import com.red.circle.other.infra.database.rds.entity.activity.UserActivityRewardClaim; @@ -49,7 +50,7 @@ public class ClaimActivityRewardExe { private final UserActivityRechargeService userActivityRechargeService; private final UserActivityRewardClaimDAO userActivityRewardClaimDAO; private final LotteryTicketClient lotteryTicketClient; - private final LatestMobileDeviceService latestMobileDeviceService; + private final RegisterDeviceGateway registerDeviceGateway; private final LotteryDeviceRecordService lotteryDeviceRecordService; private final PropsActivityClient propsActivityClient; @@ -146,7 +147,7 @@ public class ClaimActivityRewardExe { * 校验设备唯一性(防止小号薅羊毛) */ private void checkDeviceUnique(Long activityId, Long userId) { - String fingerprint = latestMobileDeviceService.getEnhancedDeviceFingerprintByUserId(userId); + String fingerprint = registerDeviceGateway.getEnhancedDeviceFingerprintByUserId(userId); if (com.red.circle.tool.core.text.StringUtils.isBlank(fingerprint)) { log.warn("Failed to get device fingerprint, userId: {}", userId); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryDrawExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryDrawExe.java index 00833e4d..1f0f1d1e 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryDrawExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryDrawExe.java @@ -8,6 +8,7 @@ import com.red.circle.other.app.dto.clientobject.activity.LotteryDrawResultCO; import com.red.circle.other.app.dto.clientobject.activity.LotteryPrizeCO; import com.red.circle.other.app.dto.cmd.activity.LotteryDrawCmd; import com.red.circle.other.app.service.activity.LotteryPrizeGrantService; +import com.red.circle.other.domain.gateway.user.ability.RegisterDeviceGateway; import com.red.circle.other.infra.database.rds.entity.activity.LotteryActivity; import com.red.circle.other.infra.database.rds.entity.activity.LotteryPrize; import com.red.circle.other.infra.database.rds.entity.activity.LotteryRecord; @@ -73,7 +74,7 @@ public class LotteryDrawExe { private final LotteryUserProgressService lotteryUserProgressService; private final LotteryPrizeGrantService lotteryPrizeGrantService; private final RedisService redisService; - private final LatestMobileDeviceService latestMobileDeviceService; + private final RegisterDeviceGateway registerDeviceGateway; private final LotteryDeviceRecordService lotteryDeviceRecordService; private final UserActivityRechargeService userActivityRechargeService; private final WalletGoldClient walletGoldClient; @@ -164,7 +165,7 @@ public class LotteryDrawExe { * 校验设备唯一性(防止小号薅羊毛) */ private void checkDeviceUnique(Long activityId, Long userId) { - String fingerprint = latestMobileDeviceService.getEnhancedDeviceFingerprintByUserId(userId); + String fingerprint = registerDeviceGateway.getEnhancedDeviceFingerprintByUserId(userId); if (com.red.circle.tool.core.text.StringUtils.isBlank(fingerprint)) { log.warn("Failed to get device fingerprint, userId: {}", userId); @@ -186,7 +187,7 @@ public class LotteryDrawExe { */ private void recordDeviceAfterDraw(Long activityId, Long userId) { try { - String fingerprint = latestMobileDeviceService.getEnhancedDeviceFingerprintByUserId(userId); + String fingerprint = registerDeviceGateway.getEnhancedDeviceFingerprintByUserId(userId); if (com.red.circle.tool.core.text.StringUtils.isNotBlank(fingerprint)) { lotteryDeviceRecordService.recordDevice(activityId, userId, fingerprint); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryMultiDrawExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryMultiDrawExe.java index 9838d3c9..e60b7ca2 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryMultiDrawExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryMultiDrawExe.java @@ -9,6 +9,7 @@ import com.red.circle.other.app.dto.clientobject.activity.LotteryMultiDrawResult import com.red.circle.other.app.dto.clientobject.activity.LotteryPrizeCO; import com.red.circle.other.app.dto.cmd.activity.LotteryMultiDrawCmd; import com.red.circle.other.app.service.activity.LotteryPrizeGrantService; +import com.red.circle.other.domain.gateway.user.ability.RegisterDeviceGateway; import com.red.circle.other.infra.database.rds.entity.activity.LotteryActivity; import com.red.circle.other.infra.database.rds.entity.activity.LotteryPrize; import com.red.circle.other.infra.database.rds.entity.activity.LotteryRecord; @@ -72,7 +73,7 @@ public class LotteryMultiDrawExe { private final LotteryUserProgressService lotteryUserProgressService; private final LotteryPrizeGrantService lotteryPrizeGrantService; private final RedisService redisService; - private final LatestMobileDeviceService latestMobileDeviceService; + private final RegisterDeviceGateway registerDeviceGateway; private final LotteryDeviceRecordService lotteryDeviceRecordService; private final UserActivityRechargeService userActivityRechargeService; private final WalletGoldClient walletGoldClient; @@ -202,7 +203,7 @@ public class LotteryMultiDrawExe { * 校验设备唯一性(防止小号薅羊毛) */ private void checkDeviceUnique(Long activityId, Long userId) { - String fingerprint = latestMobileDeviceService.getEnhancedDeviceFingerprintByUserId(userId); + String fingerprint = registerDeviceGateway.getEnhancedDeviceFingerprintByUserId(userId); if (com.red.circle.tool.core.text.StringUtils.isBlank(fingerprint)) { log.warn("Failed to get device fingerprint in multi-draw, userId: {}", userId); @@ -224,7 +225,7 @@ public class LotteryMultiDrawExe { */ private void recordDeviceAfterDraw(Long activityId, Long userId) { try { - String fingerprint = latestMobileDeviceService.getEnhancedDeviceFingerprintByUserId(userId); + String fingerprint = registerDeviceGateway.getEnhancedDeviceFingerprintByUserId(userId); if (com.red.circle.tool.core.text.StringUtils.isNotBlank(fingerprint)) { lotteryDeviceRecordService.recordDevice(activityId, userId, fingerprint); } diff --git a/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/gateway/user/ability/RegisterDeviceGateway.java b/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/gateway/user/ability/RegisterDeviceGateway.java index 37672d6c..24d0d58b 100644 --- a/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/gateway/user/ability/RegisterDeviceGateway.java +++ b/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/gateway/user/ability/RegisterDeviceGateway.java @@ -37,4 +37,13 @@ public interface RegisterDeviceGateway { * @return true-存在共享设备的主播用户, false-不存在 */ Boolean checkDeviceFingerprintHasAnchor(Long userId); + + /** + * 获取用户设备指纹(增强版) + * 包含:手机型号 + 系统版本 + IP段 + 编译版本 + * + * @param userId 用户ID + * @return 设备指纹MD5字符串 + */ + String getEnhancedDeviceFingerprintByUserId(Long userId); } diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/RegisterDeviceGatewayImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/RegisterDeviceGatewayImpl.java index 7bb49a73..790d1d1a 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/RegisterDeviceGatewayImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/RegisterDeviceGatewayImpl.java @@ -6,6 +6,7 @@ import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember; import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService; import com.red.circle.other.infra.database.rds.service.sys.EnumConfigService; import com.red.circle.other.infra.database.rds.service.user.device.LatestMobileDeviceService; +import com.red.circle.other.infra.database.rds.service.user.user.ExpandService; import com.red.circle.tool.core.text.StringUtils; import com.red.circle.tool.core.thread.ThreadPoolManager; import com.red.circle.other.domain.gateway.user.ability.RegisterDeviceGateway; @@ -32,6 +33,7 @@ public class RegisterDeviceGatewayImpl implements RegisterDeviceGateway { private final UserProfileGateway userProfileGateway; private final TeamMemberService teamMemberService; private final EnumConfigCacheService enumConfigCacheService; + private final ExpandService expandService; /** * 累计注册数量. @@ -128,4 +130,9 @@ public class RegisterDeviceGatewayImpl implements RegisterDeviceGateway { return false; } + @Override + public String getEnhancedDeviceFingerprintByUserId(Long userId) { + return latestMobileDeviceService.getEnhancedDeviceFingerprintByUserId(userId); + } + }