From f8ad2426fd1bfebb2e6923975042fb20bd574f49 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Tue, 10 Feb 2026 21:46:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Eazizi=E7=AD=BE=E5=88=B0?= =?UTF-8?q?=E9=98=B2=E6=AD=A2=E8=96=85=E7=BE=8A=E6=AF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../other/app/command/task/CheckInExe.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/task/CheckInExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/task/CheckInExe.java index d472b26d..6884b244 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/task/CheckInExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/task/CheckInExe.java @@ -10,11 +10,15 @@ import com.red.circle.other.infra.common.activity.PropsActivitySendCommon; import com.red.circle.other.infra.common.props.PropsSendCommon; import com.red.circle.other.infra.database.cache.key.CheckInKeys; import com.red.circle.other.infra.database.cache.service.other.CheckInCacheService; +import com.red.circle.other.infra.database.rds.entity.activity.LotteryDeviceRecord; import com.red.circle.other.infra.database.rds.entity.activity.PropsActivityRewardConfig; import com.red.circle.other.infra.database.rds.entity.activity.PropsActivityRuleConfig; +import com.red.circle.other.infra.database.rds.service.activity.LotteryDeviceRecordService; import com.red.circle.other.infra.database.rds.service.activity.PropsActivityRewardConfigService; import com.red.circle.other.infra.database.rds.service.activity.PropsActivityRuleConfigService; +import com.red.circle.other.infra.database.rds.service.user.device.LatestMobileDeviceService; import com.red.circle.other.inner.asserts.GameErrorCode; +import com.red.circle.other.inner.asserts.OtherErrorCode; import com.red.circle.other.inner.model.cmd.material.PrizeDescribe; import com.red.circle.other.inner.model.cmd.material.PrizeDescribeRewardCmd; import com.red.circle.other.infra.utils.ZonedDateTimeUtils; @@ -43,6 +47,9 @@ public class CheckInExe { private final PropsActivityRuleConfigService propsActivityRuleConfigService; private final PropsActivityRewardConfigService propsActivityRewardConfigService; private final PropsSendCommon propsSendCommon; + private final LatestMobileDeviceService latestMobileDeviceService; + private final LotteryDeviceRecordService lotteryDeviceRecordService; + private final static long AZIZI_FIXED_ACTIVITY_ID = 10010L; public Integer execute(CheckInRewardCmd cmd) { // 判断是否为Azizi签到(根据dailyKey是否为空) @@ -51,6 +58,9 @@ public class CheckInExe { // 设置每日签到key if (isAziziCheckIn) { cmd.setDailyKey(CheckInKeys.AZIZI_CHECK_IN.getKey("AZIZI_CHECK_IN" + cmd.getReqUserId() + ZonedDateTimeAsiaRiyadhUtils.nowDateToInt())); + + // 2. 校验设备唯一性(防止小号薅羊毛) + checkDeviceUnique(AZIZI_FIXED_ACTIVITY_ID, cmd.getReqUserId()); } else { cmd.setDailyKey(CheckInKeys.DAILY_CHECK_IN.getKey("DAILY_CHECK_IN_" + cmd.getReqUserId() + ZonedDateTimeAsiaRiyadhUtils.nowDateToInt())); } @@ -116,6 +126,7 @@ public class CheckInExe { .setQuantity(config.getQuantity()))) ); + recordDeviceAfterDraw(AZIZI_FIXED_ACTIVITY_ID, cmd.getReqUserId()); return checkInCacheService.getCheckInDays(sevenCheckInKey); @@ -124,6 +135,37 @@ public class CheckInExe { } } + /** + * 校验设备唯一性(防止小号薅羊毛) + */ + private void checkDeviceUnique(Long activityId, Long userId) { + String fingerprint = latestMobileDeviceService.getEnhancedDeviceFingerprintByUserId(userId); + + if (StringUtils.isBlank(fingerprint)) { + return; + } + + LotteryDeviceRecord existingRecord = lotteryDeviceRecordService + .getByActivityAndFingerprint(activityId, fingerprint); + + if (existingRecord != null && !existingRecord.getUserId().equals(userId)) { + ResponseAssert.isTrue(OtherErrorCode.DEVICE_ALREADY_USED, false); + } + } + + /** + * 记录设备信息 + */ + private void recordDeviceAfterDraw(Long activityId, Long userId) { + try { + String fingerprint = latestMobileDeviceService.getEnhancedDeviceFingerprintByUserId(userId); + if (StringUtils.isNotBlank(fingerprint)) { + lotteryDeviceRecordService.recordDevice(activityId, userId, fingerprint); + } + } catch (Exception e) { + } + } + /** * 构建7日签到统计key * @param isAziziCheckIn 是否为Azizi签到