debug
This commit is contained in:
@@ -27,7 +27,7 @@ def write_to_db():
|
|||||||
|
|
||||||
# 遍历Redis中所有与昨天日期相关的key,并写入数据库
|
# 遍历Redis中所有与昨天日期相关的key,并写入数据库
|
||||||
for key in r.keys(f"*:*:{yesterday}:count"):
|
for key in r.keys(f"*:*:{yesterday}:count"):
|
||||||
print('user key:' + key)
|
# print('user key:' + key)
|
||||||
parts = key.decode('utf-8').split(':')
|
parts = key.decode('utf-8').split(':')
|
||||||
group_id, wx_id, _date = parts[0], parts[1], parts[2] # _date应该是yesterday,但这里为了完整性还是保留
|
group_id, wx_id, _date = parts[0], parts[1], parts[2] # _date应该是yesterday,但这里为了完整性还是保留
|
||||||
count = int(r.hget(key, 'count')) if isinstance(r.hget(key, 'count'), bytes) else 0 # 处理可能的None或空值情况
|
count = int(r.hget(key, 'count')) if isinstance(r.hget(key, 'count'), bytes) else 0 # 处理可能的None或空值情况
|
||||||
@@ -67,7 +67,7 @@ def generate_and_send_ranking(groupId, allContacts: dict):
|
|||||||
ranking_str += f"{rank}. {allContacts[username]}: {speech_count} 次发言\n"
|
ranking_str += f"{rank}. {allContacts[username]}: {speech_count} 次发言\n"
|
||||||
# 关闭数据库连接
|
# 关闭数据库连接
|
||||||
conn.close()
|
conn.close()
|
||||||
|
print(ranking_str)
|
||||||
# 这里我们没有实际“发送”排名,只是返回字符串
|
# 这里我们没有实际“发送”排名,只是返回字符串
|
||||||
# 如果需要发送,可以在此添加发送逻辑
|
# 如果需要发送,可以在此添加发送逻辑
|
||||||
return ranking_str
|
return ranking_str
|
||||||
|
|||||||
Reference in New Issue
Block a user