feat: add adapter for 微信公众号

This commit is contained in:
wangcham
2025-02-10 06:08:59 -05:00
parent 21e1acc4f5
commit 05c1fdaa9e
8 changed files with 500 additions and 4 deletions
+2 -1
View File
@@ -171,6 +171,7 @@ class WecomClient():
elif request.method == "POST":
encrypt_msg = await request.data
ret, xml_msg = self.wxcpt.DecryptMsg(encrypt_msg, msg_signature, timestamp, nonce)
# print(xml_msg)
if ret != 0:
raise Exception(f"消息解密失败,错误码: {ret}")
@@ -228,7 +229,7 @@ class WecomClient():
if message_data["MsgType"] == "image":
message_data["MediaId"] = root.find("MediaId").text if root.find("MediaId") is not None else None
message_data["PicUrl"] = root.find("PicUrl").text if root.find("PicUrl") is not None else None
return message_data
@staticmethod