幸运24-y-定时任务-清除染色

This commit is contained in:
2025-10-20 18:32:57 +08:00
parent eb9254e0e0
commit 6f5dc9cdb7
2 changed files with 30 additions and 1 deletions

View File

@@ -264,6 +264,28 @@ public class Lucky24UserMetaService {
log.info("[Lucky24] dyeYUser uid {}", uid); log.info("[Lucky24] dyeYUser uid {}", uid);
} }
public boolean judgeYDiff(Long uid, long outputDiff) {
RMap<String, Number> userMetaMap = getUserMeta(uid);
String yInputKey = String.join("_", Y, INPUT_KEY);
long yInput = userMetaMap.getOrDefault(yInputKey, 0L).longValue();
String yOutputKey = String.join("_", Y, OUTPUT_KEY);
long yOutput = userMetaMap.getOrDefault(yOutputKey, 0L).longValue();
long judgeDiff = yInput - yOutput;
if (judgeDiff < outputDiff){
log.info("[Lucky24] judgeYDiff false uid {} judgeDiff {} outputDiff {}", uid, judgeDiff, outputDiff);
return false;
}
log.info("[Lucky24] judgeYDiff true uid {} judgeDiff {} outputDiff {}", uid, judgeDiff, outputDiff);
userMetaMap.fastRemove(Y, yInputKey, yOutputKey);
return true;
}
public RMap<String, Number> getUserMeta(Long uid) { public RMap<String, Number> getUserMeta(Long uid) {
return redissonClient.getMap(RedisKey.lucky_24_user_meta.getKey(uid.toString())); return redissonClient.getMap(RedisKey.lucky_24_user_meta.getKey(uid.toString()));
} }
@@ -275,4 +297,5 @@ public class Lucky24UserMetaService {
public RMap<String, Number> getUser10wStat(Long uid) { public RMap<String, Number> getUser10wStat(Long uid) {
return redissonClient.getMapCache(RedisKey.lucky_24_user_10w_stat.getKey(uid.toString())); return redissonClient.getMapCache(RedisKey.lucky_24_user_10w_stat.getKey(uid.toString()));
} }
} }

View File

@@ -126,8 +126,14 @@ public class Lucky24YService {
} }
private void tryClearYUser(Lucky24YUser yUser) { private void tryClearYUser(Lucky24YUser yUser) {
if (!userMetaService.judgeYDiff(yUser.getUid(), yUser.getOutputDiff())){
return;
}
Date now = new Date();
yUser.setStatus(Constant.StatusV2.invalid);
yUser.setUpdateTime(now);
lucky24YUserService.updateById(yUser);
} }
} }