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: