签到功能加入了总天数记录。
This commit is contained in:
@@ -83,15 +83,18 @@ class SignInRedisDB:
|
|||||||
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:
|
||||||
"""增加用户签到总次数"""
|
"""增加用户签到总次数"""
|
||||||
key = self.get_user_total_sign_count_key(wx_id, group_id)
|
key = self.get_user_total_sign_count_key(wx_id, group_id)
|
||||||
return self.redis.incr(key)
|
with self.get_redis_connection() as redis_client:
|
||||||
|
return redis_client.incr(key)
|
||||||
|
|
||||||
def get_user_total_sign_count(self, wx_id: str, group_id: str) -> int:
|
def get_user_total_sign_count(self, wx_id: str, group_id: str) -> int:
|
||||||
"""获取用户签到总次数"""
|
"""获取用户签到总次数"""
|
||||||
key = self.get_user_total_sign_count_key(wx_id, group_id)
|
key = self.get_user_total_sign_count_key(wx_id, group_id)
|
||||||
count = self.redis.get(key)
|
with self.get_redis_connection() as redis_client:
|
||||||
return int(count) if count else 0
|
count = redis_client.get(key)
|
||||||
|
return int(count) if count else 0
|
||||||
|
|
||||||
def set_user_total_sign_count(self, wx_id: str, group_id: str, count: int) -> bool:
|
def set_user_total_sign_count(self, wx_id: str, group_id: str, count: int) -> bool:
|
||||||
"""设置用户签到总次数"""
|
"""设置用户签到总次数"""
|
||||||
key = self.get_user_total_sign_count_key(wx_id, group_id)
|
key = self.get_user_total_sign_count_key(wx_id, group_id)
|
||||||
return self.redis.set(key, count)
|
with self.get_redis_connection() as redis_client:
|
||||||
|
return redis_client.set(key, count)
|
||||||
|
|||||||
Reference in New Issue
Block a user