设备指纹校验位置修改
This commit is contained in:
parent
98778761ff
commit
341ac90455
@ -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<String> 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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -37,4 +37,13 @@ public interface RegisterDeviceGateway {
|
||||
* @return true-存在共享设备的主播用户, false-不存在
|
||||
*/
|
||||
Boolean checkDeviceFingerprintHasAnchor(Long userId);
|
||||
|
||||
/**
|
||||
* 获取用户设备指纹(增强版)
|
||||
* 包含:手机型号 + 系统版本 + IP段 + 编译版本
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 设备指纹MD5字符串
|
||||
*/
|
||||
String getEnhancedDeviceFingerprintByUserId(Long userId);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user