From 162a0aac4376c2c90c33e92ad810b9939da3660f Mon Sep 17 00:00:00 2001 From: liuwei Date: Fri, 19 Sep 2025 09:51:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=BE=E5=88=B0=E5=8A=9F=E8=83=BD=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E4=BA=86=E6=80=BB=E5=A4=A9=E6=95=B0=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/sign_in_redis.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/db/sign_in_redis.py b/db/sign_in_redis.py index 64bbfee..6bceffb 100644 --- a/db/sign_in_redis.py +++ b/db/sign_in_redis.py @@ -70,7 +70,8 @@ class SignInRedisDB: for key in keys: if isinstance(key, bytes): key = key.decode('utf-8') - if key != f'{self.prefix}last_reset_date': + # 只删除每日签到计数键,保留用户总签到次数和重置日期 + if key != f'{self.prefix}last_reset_date' and not key.startswith(f'{self.prefix}user_total:'): redis_client.delete(key) return True except Exception: @@ -78,7 +79,7 @@ class SignInRedisDB: def get_user_total_sign_count_key(self, wx_id: str, group_id: str) -> str: """获取用户总签到次数的Redis键""" - return f"{self.prefix}sign:total:{wx_id}:{group_id}" + return f"{self.prefix}user_total:{wx_id}:{group_id}" def increment_user_sign_count(self, wx_id: str, group_id: str) -> int: """增加用户签到总次数"""