From 4f9f9096aa3e08e0157e9ca6190317a5d1c82e71 Mon Sep 17 00:00:00 2001 From: H Vs Date: Fri, 28 Feb 2025 16:04:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/messages_resource.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/resources/messages_resource.py b/resources/messages_resource.py index 7813019..65fa36b 100644 --- a/resources/messages_resource.py +++ b/resources/messages_resource.py @@ -98,7 +98,12 @@ class MessagesResource(Resource): ''' wxid = msg.get("Wxid") msg_data = msg.get("Data") - handle_mod_contacts(token_id,app_id,wxid,msg_data) + # + #handle_mod_contacts(token_id,app_id,wxid,msg_data) + + # + threading.Thread(target=handle_mod_contacts, args=(token_id,app_id,wxid,msg_data)).start() + elif type_name=="DelContacts": ''' 删除好友通知/退出群聊 @@ -774,9 +779,14 @@ def handle_mod_contacts(token_id,app_id,wxid,msg_data): ret,msg,contacts_list = gewe_chat.wxchat.fetch_contacts_list(token_id, app_id) - friend_wxids = contacts_list['friends'][3:] # 可以调整截取范围 - print(friend_wxids) + # friend_wxids = contacts_list['friends'][3:] # 可以调整截取范围 + # print(friend_wxids) + + #friend_wxids.remove('fmessage') #friend_wxids.remove('weixin') + + friend_wxids = [c for c in contacts_list['friends'] if c not in ['fmessage', 'medianote','weixin']] # 可以调整截取范围 + print(f'{wxid}的好友数量{len(friend_wxids)}') gewe_chat.wxchat.save_contacts_brief_to_cache(token_id, app_id, wxid, friend_wxids) else: