幸运24-y-定时任务-清除染色
This commit is contained in:
@@ -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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user