新增azizi签到防止薅羊毛
This commit is contained in:
parent
9b62479aff
commit
f8ad2426fd
@ -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签到
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user