diff --git a/model/Models.py b/model/Models.py index ac127e6..e1a3ed9 100644 --- a/model/Models.py +++ b/model/Models.py @@ -1,7 +1,7 @@ from pydantic import BaseModel, ValidationError from dataclasses import dataclass, asdict from typing import List - +from enum import Enum, unique @dataclass class AgentConfig(BaseModel): @@ -17,4 +17,12 @@ class AddGroupContactsHistory(BaseModel): chatroomId:str wxid:str contactWixd:str - addTime:int \ No newline at end of file + addTime:int + + + +@unique +class OperationType(Enum): + ADD_FRIEND = 2 + ACCEPT_FRIEND = 3 + REJECT_FRIEND = 4 \ No newline at end of file diff --git a/resources/messages_resource.py b/resources/messages_resource.py index e60d787..3e6a369 100644 --- a/resources/messages_resource.py +++ b/resources/messages_resource.py @@ -7,6 +7,7 @@ from common import utils,redis_helper,memory,kafka_helper from common.log import logger import xml.etree.ElementTree as ET import threading,time +from model import Models import os @@ -164,7 +165,9 @@ def handle_name_card(token_id,app_id, wxid,msg_data,from_wxid, to_wxid): return response # 将加好友资料添加到待加好友队列 - gewe_chat.wxchat.enqueue_to_add_contacts(wxid,scene,v3,v4) + #gewe_chat.wxchat.enqueue_to_add_contacts(wxid,scene,v3,v4) + + gewe_chat.wxchat.add_contacts(token_id,app_id,scene,Models.OperationType.ADD_FRIEND,v3,v4,alias_value) except ET.ParseError as e: logger.error(f"XML解析错误: {e}")