From 4cdb7b1b8bf316d88f9eaa74823e59fa32732db8 Mon Sep 17 00:00:00 2001 From: H Vs Date: Tue, 29 Apr 2025 14:54:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=95=86=E6=9C=BA=E5=8A=A9?= =?UTF-8?q?=E7=90=86=E6=AD=A3=E5=BC=8F=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/endpoints/pipeline_endpoint.py | 19 +++++++++++++++---- services/biz_service.py | 5 +++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/endpoints/pipeline_endpoint.py b/app/endpoints/pipeline_endpoint.py index 6ec794f..5acb832 100644 --- a/app/endpoints/pipeline_endpoint.py +++ b/app/endpoints/pipeline_endpoint.py @@ -418,13 +418,23 @@ async def handle_text_async(request: Request,token_id,app_id, wxid,msg_data,from 18664262743 wxid_9pocbage7cdb22 ''' + + ''' + 测试环境的商机提醒使用:15986163393,wxid_488eunhhppbs22 + ''' contacts_brief= await request.app.state.gewe_service.get_contacts_brief_from_cache_async(wxid) contact_nick_name=next(filter(lambda x:x.get("userName") == callback_to_user,contacts_brief),{}).get("nickName","") assistant_msg_content=f'AI管家转人工提醒:【{contact_nick_name}】有{found_keywords[0]}需求' - await request.app.state.gewe_service.post_text_async(token_id, app_id, 'wxid_9pocbage7cdb22', assistant_msg_content) + + biz_assistant_wxid="wxid_9pocbage7cdb22" + environment = os.environ.get('environment', 'default') + if environment=='test': + biz_assistant_wxid='wxid_488eunhhppbs22' + + await request.app.state.gewe_service.post_text_async(token_id, app_id, biz_assistant_wxid, assistant_msg_content) - k,loginfo=await request.app.state.gewe_service.get_login_info_by_wxid_async('wxid_9pocbage7cdb22') + k,loginfo=await request.app.state.gewe_service.get_login_info_by_wxid_async(biz_assistant_wxid) if not k: logger.warning(f'助理微信号 wxid_9pocbage7cdb22 不存在') return @@ -1162,12 +1172,13 @@ async def handle_xml_async(request: Request,token_id,app_id, wxid,msg_data,from_ handlers = { 57: handle_xml_reference_async, 5: handle_xml_invite_group_async, - 74: handle_file_message_async + 74: handle_file_message_async #直发 + } # 判断是否为群 if check_chatroom(from_wxid) or check_chatroom(to_wxid): handlers[74]=handle_file_message_group_async - + handler = handlers.get(type_value) if handler: return await handler(request,token_id,app_id, wxid,msg_data,from_wxid, to_wxid) diff --git a/services/biz_service.py b/services/biz_service.py index 98c888f..ba8cd0f 100644 --- a/services/biz_service.py +++ b/services/biz_service.py @@ -549,7 +549,12 @@ class BizService(): if wx_content_list is None or len(wx_content_list) == 0: logger.warning(f'wx_content_list 空列表不处理 {wx_content_list}') return + biz_assistant_wxid="wxid_9pocbage7cdb22" + environment = os.environ.get('environment', 'default') + if environment=='test': + biz_assistant_wxid='wxid_488eunhhppbs22' + k, loginfo = await self.wxchat.get_login_info_by_wxid_async(biz_assistant_wxid) if not loginfo: logger.warning(f'{biz_assistant_wxid} 助理信信息不存在')