mirror of
https://github.com/Sitoi/dailycheckin.git
synced 2024-11-17 13:48:03 +08:00
Merge pull request #311 from kevinBobo/main
🐛 修复(message.py):微信企业通知增加反向代理功能
This commit is contained in:
commit
fac507ec7a
@ -123,11 +123,14 @@ def message2qywxrobot(qywx_key, content):
|
|||||||
|
|
||||||
|
|
||||||
def message2qywxapp(
|
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("企业微信应用消息推送开始")
|
print("企业微信应用消息推送开始")
|
||||||
|
bastUrl = "https://qyapi.weixin.qq.com"
|
||||||
|
if qywx_origin:
|
||||||
|
bastUrl = qywx_origin;
|
||||||
res = requests.get(
|
res = requests.get(
|
||||||
f"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={qywx_corpid}&corpsecret={qywx_corpsecret}"
|
f"{bastUrl}/cgi-bin/gettoken?corpid={qywx_corpid}&corpsecret={qywx_corpsecret}"
|
||||||
)
|
)
|
||||||
token = res.json().get("access_token", False)
|
token = res.json().get("access_token", False)
|
||||||
if qywx_media_id:
|
if qywx_media_id:
|
||||||
@ -161,7 +164,7 @@ def message2qywxapp(
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
requests.post(
|
requests.post(
|
||||||
url=f"https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={token}",
|
url=f"{bastUrl}/cgi-bin/message/send?access_token={token}",
|
||||||
data=json.dumps(data),
|
data=json.dumps(data),
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
@ -219,6 +222,7 @@ def push_message(content_list: list, notice_info: dict):
|
|||||||
qywx_corpsecret = notice_info.get("qywx_corpsecret")
|
qywx_corpsecret = notice_info.get("qywx_corpsecret")
|
||||||
qywx_touser = notice_info.get("qywx_touser")
|
qywx_touser = notice_info.get("qywx_touser")
|
||||||
qywx_media_id = notice_info.get("qywx_media_id")
|
qywx_media_id = notice_info.get("qywx_media_id")
|
||||||
|
qywx_origin = notice_info.get("qywx_origin")
|
||||||
pushplus_token = notice_info.get("pushplus_token")
|
pushplus_token = notice_info.get("pushplus_token")
|
||||||
pushplus_topic = notice_info.get("pushplus_topic")
|
pushplus_topic = notice_info.get("pushplus_topic")
|
||||||
merge_push = notice_info.get("merge_push")
|
merge_push = notice_info.get("merge_push")
|
||||||
@ -271,6 +275,7 @@ def push_message(content_list: list, notice_info: dict):
|
|||||||
qywx_corpsecret=qywx_corpsecret,
|
qywx_corpsecret=qywx_corpsecret,
|
||||||
qywx_touser=qywx_touser,
|
qywx_touser=qywx_touser,
|
||||||
qywx_media_id=qywx_media_id,
|
qywx_media_id=qywx_media_id,
|
||||||
|
qywx_origin=qywx_origin,
|
||||||
content=message,
|
content=message,
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
"QYWX_KEY":"",
|
"QYWX_KEY":"",
|
||||||
"QYWX_MEDIA_ID":"",
|
"QYWX_MEDIA_ID":"",
|
||||||
"QYWX_TOUSER":"",
|
"QYWX_TOUSER":"",
|
||||||
|
"QYWX_ORIGIN":"",
|
||||||
"SCKEY":"",
|
"SCKEY":"",
|
||||||
"SENDKEY":"",
|
"SENDKEY":"",
|
||||||
"TG_API_HOST":"",
|
"TG_API_HOST":"",
|
||||||
|
@ -70,4 +70,5 @@ import { Cards, Card } from 'nextra/components'
|
|||||||
| _**QYWX_CORPSECRET**_ | corpsecret |
|
| _**QYWX_CORPSECRET**_ | corpsecret |
|
||||||
| _**QYWX_TOUSER**_ | touser |
|
| _**QYWX_TOUSER**_ | touser |
|
||||||
| _**QYWX_MEDIA_ID**_ | media_id |
|
| _**QYWX_MEDIA_ID**_ | media_id |
|
||||||
|
| _**QYWX_ORIGIN**_ | 企业微信反向代理地址 https://qyapi.weixin.qq.com/cgi-bin/gettoken将其中的https://qyapi.weixin.qq.com替换为**QYWX_ORIGIN** |
|
||||||
| _**MERGE_PUSH**_ | **true**: 将推送消息合并;**false**: 分开推送 |
|
| _**MERGE_PUSH**_ | **true**: 将推送消息合并;**false**: 分开推送 |
|
||||||
|
Loading…
Reference in New Issue
Block a user