This commit is contained in:
yumoqing 2026-03-02 13:42:39 +08:00
parent 1982f77828
commit e132f9dddc

View File

@ -184,13 +184,14 @@ class WOAHandler:
return web.Response(text="failed", status=403)
# 2. 读取并解密消息体
body=''
try:
body = await request.read()
# decrypt_message 会自动处理解密和 XML 解析,返回 wechatpy 的消息对象
# 如果未开启加密,它也会正常解析 XML
msg = self.crypto.decrypt_message(body)
except Exception as e:
logger.error(f"消息解密或解析失败: {e}")
error(f"消息解密或解析失败: {e}, {body=}")
return web.Response(text="success") # 防止微信重试
debug(f"收到消息类型: {type(msg).__name__}")