debug 入库

This commit is contained in:
liuwei
2025-02-05 13:35:14 +08:00
parent 451f885f2d
commit 4c13b552d8

View File

@@ -25,7 +25,7 @@ def write_to_db():
# 遍历Redis中所有与昨天日期相关的key并写入数据库
for key in r.keys(f"*:*:{yesterday}:count"):
print('user key{key}')
print('user key'+ key)
parts = key.decode('utf-8').split(':')
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或空值情况