|
@@ -189,6 +189,7 @@ async def handle_add_messages_async(request: Request,token_id,msg,wxid): |
|
|
3: handle_image_async, |
|
|
3: handle_image_async, |
|
|
34: handle_voice_async, |
|
|
34: handle_voice_async, |
|
|
42: handle_name_card_async, |
|
|
42: handle_name_card_async, |
|
|
|
|
|
43: handle_video_async, |
|
|
49: handle_xml_async, |
|
|
49: handle_xml_async, |
|
|
37: handle_add_friend_notice_async, |
|
|
37: handle_add_friend_notice_async, |
|
|
10002: handle_10002_msg_async, |
|
|
10002: handle_10002_msg_async, |
|
@@ -1015,6 +1016,25 @@ async def handle_name_card_async(request: Request,token_id,app_id, wxid,msg_data |
|
|
except Exception as e: |
|
|
except Exception as e: |
|
|
logger.error(f"未知错误: {e}") |
|
|
logger.error(f"未知错误: {e}") |
|
|
|
|
|
|
|
|
|
|
|
async def handle_video_async(request: Request,token_id,app_id, wxid,msg_data,from_wxid, to_wxid): |
|
|
|
|
|
logger.info('视频消息') |
|
|
|
|
|
try: |
|
|
|
|
|
msg_content_xml=msg_data["Content"]["string"] |
|
|
|
|
|
video_url=await request.app.state.gewe_service.download_video_msg_async(token_id,app_id,msg_content_xml) |
|
|
|
|
|
if not video_url: |
|
|
|
|
|
logger.warning(f'处理视频消息异常') |
|
|
|
|
|
return |
|
|
|
|
|
callback_to_user=from_wxid |
|
|
|
|
|
print(video_url) |
|
|
|
|
|
wx_content_dialogue_message = [{"type": "file", "file_url": {"url":video_url}}] |
|
|
|
|
|
k_message = dialogue_message(callback_to_user,wxid, wx_content_dialogue_message) |
|
|
|
|
|
await request.app.state.kafka_service.send_message_async(k_message) |
|
|
|
|
|
logger.info("发送对话 %s",k_message) |
|
|
|
|
|
except Exception as e: |
|
|
|
|
|
logger.error(f"出现错误: {e}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def handle_xml_async(request: Request,token_id,app_id, wxid,msg_data,from_wxid, to_wxid): |
|
|
async def handle_xml_async(request: Request,token_id,app_id, wxid,msg_data,from_wxid, to_wxid): |
|
|
''' |
|
|
''' |
|
|
处理xml |
|
|
处理xml |
|
|