From 95fef73ce19ee52ab9611cfc643d36fece9e503e Mon Sep 17 00:00:00 2001 From: hanyabo Date: Wed, 6 Mar 2024 14:31:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E4=BC=81=E4=B8=9A=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=A2=9E=E5=8A=A0=E5=8F=8D=E5=90=91=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dailycheckin/utils/message.py | 18 +++++++++++++----- docker/config.template.json | 1 + 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/dailycheckin/utils/message.py b/dailycheckin/utils/message.py index 22ef715..62cb79c 100755 --- a/dailycheckin/utils/message.py +++ b/dailycheckin/utils/message.py @@ -122,7 +122,7 @@ def message2qywxrobot(qywx_key, content): def message2qywxapp( - qywx_corpid, qywx_agentid, qywx_corpsecret, qywx_touser, qywx_media_id, content + qywx_corpid, qywx_agentid, qywx_corpsecret, qywx_touser, qywx_media_id, qywx_origin, content ): print("企业微信应用消息推送开始") res = requests.get( @@ -159,10 +159,16 @@ def message2qywxapp( "btntxt": "开源项目", }, } - requests.post( - url=f"https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={token}", - data=json.dumps(data), - ) + if qywx_origin: + requests.post( + url=f"{qywx_origin}/cgi-bin/message/send?access_token={token}", + data=json.dumps(data), + ) + else: + requests.post( + url=f"https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={token}", + data=json.dumps(data), + ) return @@ -218,6 +224,7 @@ def push_message(content_list: list, notice_info: dict): qywx_corpsecret = notice_info.get("qywx_corpsecret") qywx_touser = notice_info.get("qywx_touser") qywx_media_id = notice_info.get("qywx_media_id") + qywx_origin = notice_info.get("qywx_origin") pushplus_token = notice_info.get("pushplus_token") pushplus_topic = notice_info.get("pushplus_topic") merge_push = notice_info.get("merge_push") @@ -270,6 +277,7 @@ def push_message(content_list: list, notice_info: dict): qywx_corpsecret=qywx_corpsecret, qywx_touser=qywx_touser, qywx_media_id=qywx_media_id, + qywx_origin=qywx_origin, content=message, ) except Exception as e: diff --git a/docker/config.template.json b/docker/config.template.json index c51515e..38ff48f 100644 --- a/docker/config.template.json +++ b/docker/config.template.json @@ -17,6 +17,7 @@ "QYWX_KEY":"", "QYWX_MEDIA_ID":"", "QYWX_TOUSER":"", + "QYWX_ORIGIN":"", "SCKEY":"", "SENDKEY":"", "TG_API_HOST":"",