添加密码重置

This commit is contained in:
咕谷酱
2025-08-22 08:56:40 +08:00
parent 3bee2421fa
commit 0f9238c501
7 changed files with 727 additions and 7 deletions

View File

@@ -480,14 +480,19 @@ class EnhancedIntervalStatsManager:
keys = await redis_async.keys(pattern)
for key in keys:
try:
# 从key中提取时间
time_part = key.decode().split(":")[-1] # YYYYMMDD_HHMM格式
# 从key中提取时间,处理字节或字符串类型
if isinstance(key, bytes):
key_str = key.decode()
else:
key_str = key
time_part = key_str.split(":")[-1] # YYYYMMDD_HHMM格式
key_time = datetime.strptime(time_part, "%Y%m%d_%H%M")
if key_time < cutoff_time:
await redis_async.delete(key)
# 也删除对应的用户集合
await redis_async.delete(f"{INTERVAL_ONLINE_USERS_KEY}:{key}")
# 使用key_str确保正确拼接用户集合键
await redis_async.delete(f"{INTERVAL_ONLINE_USERS_KEY}:{key_str}")
await redis_async.delete(f"{INTERVAL_PLAYING_USERS_KEY}:{key}")
except (ValueError, IndexError):