From 79a856f8c551577a9b3a3a4a259c428fa2797324 Mon Sep 17 00:00:00 2001 From: aaron <> Date: Tue, 4 Mar 2025 15:47:13 +0800 Subject: [PATCH] updaet --- app/core/wecomclient.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/core/wecomclient.py b/app/core/wecomclient.py index f9f6ba5..b5393b6 100644 --- a/app/core/wecomclient.py +++ b/app/core/wecomclient.py @@ -112,7 +112,7 @@ class WecomClient: logging.error(f"unionid_to_external_userid异常: {str(e)}") return None - async def send_welcome_message(self, group_id: str) -> bool: + async def send_welcome_message(self, chat_id: str) -> bool: """发送欢迎消息""" try: # 1. 获取 access_token @@ -122,10 +122,9 @@ class WecomClient: return False # 2. 发送欢迎消息 - url = "https://qyapi.weixin.qq.com/cgi-bin/message/send" - params = { - "access_token": access_token, - "group_id": group_id, + url = f"https://qyapi.weixin.qq.com/cgi-bin/appchat/send?access_token={access_token}" + data = { + "chatid": chat_id, "msgtype": "text", "text": { "content": f"""🥳 欢迎您进群,在群内可以享受📦【代取快递】跑腿服务。 @@ -137,11 +136,12 @@ class WecomClient: 𝟐 赠送𝟔枚鲜鸡蛋【首次下单】 ━ ━ ━ ━ ━🎊━ ━ ━ ━ ━ ↓点击↓小程序领券下单 &""" - } + }, + "safe": 0 } async with aiohttp.ClientSession() as session: - async with session.post(url, json=params) as response: + async with session.post(url, json=data) as response: result = await response.json() if result.get("errcode") == 0: return True