签到功能加入了总天数记录。
This commit is contained in:
@@ -70,7 +70,8 @@ class SignInRedisDB:
|
|||||||
for key in keys:
|
for key in keys:
|
||||||
if isinstance(key, bytes):
|
if isinstance(key, bytes):
|
||||||
key = key.decode('utf-8')
|
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)
|
redis_client.delete(key)
|
||||||
return True
|
return True
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -78,7 +79,7 @@ class SignInRedisDB:
|
|||||||
|
|
||||||
def get_user_total_sign_count_key(self, wx_id: str, group_id: str) -> str:
|
def get_user_total_sign_count_key(self, wx_id: str, group_id: str) -> str:
|
||||||
"""获取用户总签到次数的Redis键"""
|
"""获取用户总签到次数的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:
|
def increment_user_sign_count(self, wx_id: str, group_id: str) -> int:
|
||||||
"""增加用户签到总次数"""
|
"""增加用户签到总次数"""
|
||||||
|
|||||||
Reference in New Issue
Block a user