fix 部分api请求失败情况下,不会噶了
This commit is contained in:
1 parent
5d18f4193c
commit
a4ba8fa50d
4 files changed
+6
-5
No files matched your search
@@ -203,7 +203,7 @@ def msg_count():
|
||||
db_config = get_conf(g.caf, my_wxid, "db_config")
|
||||
db = DBHandler(db_config)
|
||||
chat_count = db.get_msg_count(wxid)
|
||||
chat_count1 = db.get_plc_msg_count(wxid)
|
||||
chat_count1 = db.get_plc_msg_count(wxid) if db.PublicMsg_exist else {}
|
||||
# 合并两个字典,相同key,则将value相加
|
||||
count = {k: chat_count.get(k, 0) + chat_count1.get(k, 0) for k in
|
||||
list(set(list(chat_count.keys()) + list(chat_count1.keys())))}
|
||||
@@ -234,7 +234,7 @@ def get_msgs():
|
||||
|
||||
db = DBHandler(db_config)
|
||||
msgs, wxid_list = db.get_msg_list(wxid=wxid, start_index=start, page_size=limit)
|
||||
if not msgs:
|
||||
if not msgs and db.PublicMsg_exist:
|
||||
msgs, wxid_list = db.get_plc_msg_list(wxid=wxid, start_index=start, page_size=limit)
|
||||
wxid_list.append(my_wxid)
|
||||
user = db.get_user_list(wxids=wxid_list)
|
||||
|
||||
Reference in new issue
Block a user