幸运24-额外-meta增加todayInput和todayOutput计数器

This commit is contained in:
2025-10-17 11:20:41 +08:00
parent 243692808d
commit 121147ca44

View File

@@ -184,6 +184,10 @@ public class Lucky24UserMetaService {
String today = String.valueOf(todayStartTimeLong);
String todayTimesKey = String.join("_", today, TIMES_KEY);
long todayTimes = userMetaMap.addAndGet(todayTimesKey, 1L).longValue();
String todayInputKey = String.join("_", today, INPUT_KEY);
long todayInput = userMetaMap.addAndGet(todayInputKey, input).longValue();
String todayOutputKey = String.join("_", today, OUTPUT_KEY);
long todayOutput = userMetaMap.addAndGet(todayOutputKey, output).longValue();
long userMetaToday = userMetaMap.computeIfAbsent(TODAY, k->todayStartTimeLong).longValue();
if (userMetaToday < todayStartTimeLong
@@ -211,7 +215,8 @@ public class Lucky24UserMetaService {
Set<String> needDeleteKeySet = new HashSet<>();
for (String key : userMetaMapSnapshot.keySet()){
if (key.startsWith(INPUT_KEY) || key.startsWith(OUTPUT_KEY)){
if ((key.startsWith(INPUT_KEY) && !key.equals(INPUT_KEY))
|| (key.startsWith(OUTPUT_KEY) && !key.equals(OUTPUT_KEY))){
if (key.endsWith(TWO_DAY_AGO)){
continue;
}
@@ -255,8 +260,8 @@ public class Lucky24UserMetaService {
}
}
log.info("[Lucky24] updateUserMeta uid {} times {} today {} todayTimes {}",
senderUid, times, todayStartTimeLong, todayTimes);
log.info("[Lucky24] updateUserMeta uid {} times {} todayInput {} todayOutput {} today {} todayTimes {} todayIntput {} todayOutput {}",
senderUid, times, totalInput, totalOutput, todayStartTimeLong, todayTimes, todayInput, todayOutput);
}
public RMap<String, Number> getUserMeta(Long uid) {