From 89f2bf5f301b057ccb190e1e4c289aa8cc60a954 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 9 Sep 2024 22:54:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20message.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/endpoints/message.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/api/endpoints/message.py b/app/api/endpoints/message.py index e2f205dec..a1af1f6c3 100644 --- a/app/api/endpoints/message.py +++ b/app/api/endpoints/message.py @@ -85,7 +85,7 @@ def wechat_verify(echostr: str, msg_signature: str, timestamp: Union[str, int], if not clients: return for client in clients: - if client.type == "wechat" and client.enabled and client.name == source: + if client.type == "wechat" and client.enabled and (not source or client.name == source): try: wxcpt = WXBizMsgCrypt(sToken=client.config.get('WECHAT_TOKEN'), sEncodingAESKey=client.config.get('WECHAT_ENCODING_AESKEY'), @@ -114,14 +114,14 @@ def vocechat_verify(token: str) -> Any: @router.get("/", summary="回调请求验证") def incoming_verify(token: str = None, echostr: str = None, msg_signature: str = None, - timestamp: Union[str, int] = None, nonce: str = None) -> Any: + timestamp: Union[str, int] = None, nonce: str = None, source: str = None) -> Any: """ 微信/VoceChat等验证响应 """ logger.info(f"收到验证请求: token={token}, echostr={echostr}, " f"msg_signature={msg_signature}, timestamp={timestamp}, nonce={nonce}") if echostr and msg_signature and timestamp and nonce: - return wechat_verify(echostr, msg_signature, timestamp, nonce) + return wechat_verify(echostr, msg_signature, timestamp, nonce, source) return vocechat_verify(token)