mirror of https://github.com/6dylan6/jdpro.git
增加企业微信代理地址
This commit is contained in:
parent
c637d5d25c
commit
55d374abe2
|
@ -73,7 +73,7 @@ let DD_BOT_SECRET = '';
|
||||||
//此处填你企业微信机器人的 webhook(详见文档 https://work.weixin.qq.com/api/doc/90000/90136/91770),例如:693a91f6-7xxx-4bc4-97a0-0ec2sifa5aaa
|
//此处填你企业微信机器人的 webhook(详见文档 https://work.weixin.qq.com/api/doc/90000/90136/91770),例如:693a91f6-7xxx-4bc4-97a0-0ec2sifa5aaa
|
||||||
//(环境变量名 QYWX_KEY)
|
//(环境变量名 QYWX_KEY)
|
||||||
let QYWX_KEY = '';
|
let QYWX_KEY = '';
|
||||||
|
let QYWX_ORIGIN = 'qyapi.weixin.qq.com';
|
||||||
// =======================================企业微信应用消息通知设置区域===========================================
|
// =======================================企业微信应用消息通知设置区域===========================================
|
||||||
/*
|
/*
|
||||||
此处填你企业微信应用消息的值(详见文档 https://work.weixin.qq.com/api/doc/90000/90135/90236)
|
此处填你企业微信应用消息的值(详见文档 https://work.weixin.qq.com/api/doc/90000/90135/90236)
|
||||||
|
@ -232,6 +232,7 @@ async function sendNotify(text, desp, params = {}, author = "\n=================
|
||||||
DD_BOT_TOKEN = '';
|
DD_BOT_TOKEN = '';
|
||||||
DD_BOT_SECRET = '';
|
DD_BOT_SECRET = '';
|
||||||
QYWX_KEY = '';
|
QYWX_KEY = '';
|
||||||
|
QYWX_ORIGIN = 'qyapi.weixin.qq.com';
|
||||||
QYWX_AM = '';
|
QYWX_AM = '';
|
||||||
FS_KEY = '';
|
FS_KEY = '';
|
||||||
IGOT_PUSH_KEY = '';
|
IGOT_PUSH_KEY = '';
|
||||||
|
@ -684,6 +685,9 @@ async function sendNotify(text, desp, params = {}, author = "\n=================
|
||||||
if (process.env["QYWX_AM" + UseGroupNotify] && Use_qywxamNotify) {
|
if (process.env["QYWX_AM" + UseGroupNotify] && Use_qywxamNotify) {
|
||||||
QYWX_AM = process.env["QYWX_AM" + UseGroupNotify];
|
QYWX_AM = process.env["QYWX_AM" + UseGroupNotify];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (process.env["QYWX_ORIGIN"])
|
||||||
|
QYWX_ORIGIN = process.env["QYWX_ORIGIN"];
|
||||||
|
|
||||||
if (process.env["FS_KEY" + UseGroupNotify] && Use_fsBotNotify) {
|
if (process.env["FS_KEY" + UseGroupNotify] && Use_fsBotNotify) {
|
||||||
FS_KEY = process.env["FS_KEY" + UseGroupNotify];
|
FS_KEY = process.env["FS_KEY" + UseGroupNotify];
|
||||||
|
@ -1492,7 +1496,7 @@ function ddBotNotify(text, desp) {
|
||||||
function qywxBotNotify(text, desp) {
|
function qywxBotNotify(text, desp) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const options = {
|
const options = {
|
||||||
url: `https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${QYWX_KEY}`,
|
url: `https://${QYWX_ORIGIN}/cgi-bin/webhook/send?key=${QYWX_KEY}`,
|
||||||
json: {
|
json: {
|
||||||
msgtype: 'text',
|
msgtype: 'text',
|
||||||
text: {
|
text: {
|
||||||
|
@ -1610,7 +1614,7 @@ function qywxamNotify(text, desp, strsummary = "") {
|
||||||
if (QYWX_AM) {
|
if (QYWX_AM) {
|
||||||
const QYWX_AM_AY = QYWX_AM.split(',');
|
const QYWX_AM_AY = QYWX_AM.split(',');
|
||||||
const options_accesstoken = {
|
const options_accesstoken = {
|
||||||
url: `https://qyapi.weixin.qq.com/cgi-bin/gettoken`,
|
url: `https://${QYWX_ORIGIN}/cgi-bin/gettoken`,
|
||||||
json: {
|
json: {
|
||||||
corpid: `${QYWX_AM_AY[0]}`,
|
corpid: `${QYWX_AM_AY[0]}`,
|
||||||
corpsecret: `${QYWX_AM_AY[1]}`,
|
corpsecret: `${QYWX_AM_AY[1]}`,
|
||||||
|
@ -1677,7 +1681,7 @@ function qywxamNotify(text, desp, strsummary = "") {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
options = {
|
options = {
|
||||||
url: `https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=${accesstoken}`,
|
url: `https://${QYWX_ORIGIN}/cgi-bin/message/send?access_token=${accesstoken}`,
|
||||||
json: {
|
json: {
|
||||||
touser: `${ChangeUserId(desp)}`,
|
touser: `${ChangeUserId(desp)}`,
|
||||||
agentid: `${QYWX_AM_AY[3]}`,
|
agentid: `${QYWX_AM_AY[3]}`,
|
||||||
|
|
|
@ -23,7 +23,7 @@ sys.path.append(root_path)
|
||||||
# 通知服务
|
# 通知服务
|
||||||
BARK = '' # bark服务,自行搜索; secrets可填;
|
BARK = '' # bark服务,自行搜索; secrets可填;
|
||||||
BARK_PUSH='' # bark自建服务器,要填完整链接,结尾的/不要
|
BARK_PUSH='' # bark自建服务器,要填完整链接,结尾的/不要
|
||||||
PUSH_KEY = '' # Server酱的PUSH_KEY; secrets可填
|
PUSH_KEY = '' # Server酱的PUSH_KEY; secrets可填
|
||||||
TG_BOT_TOKEN = '' # tg机器人的TG_BOT_TOKEN; secrets可填1407203283:AAG9rt-6RDaaX0HBLZQq0laNOh898iFYaRQ
|
TG_BOT_TOKEN = '' # tg机器人的TG_BOT_TOKEN; secrets可填1407203283:AAG9rt-6RDaaX0HBLZQq0laNOh898iFYaRQ
|
||||||
TG_USER_ID = '' # tg机器人的TG_USER_ID; secrets可填 1434078534
|
TG_USER_ID = '' # tg机器人的TG_USER_ID; secrets可填 1434078534
|
||||||
TG_API_HOST='' # tg 代理api
|
TG_API_HOST='' # tg 代理api
|
||||||
|
@ -33,8 +33,9 @@ DD_BOT_TOKEN = '' # 钉钉机器人的DD_BOT_TOKEN; secrets可填
|
||||||
DD_BOT_SECRET = '' # 钉钉机器人的DD_BOT_SECRET; secrets可填
|
DD_BOT_SECRET = '' # 钉钉机器人的DD_BOT_SECRET; secrets可填
|
||||||
QQ_SKEY = '' # qq机器人的QQ_SKEY; secrets可填
|
QQ_SKEY = '' # qq机器人的QQ_SKEY; secrets可填
|
||||||
QQ_MODE = '' # qq机器人的QQ_MODE; secrets可填
|
QQ_MODE = '' # qq机器人的QQ_MODE; secrets可填
|
||||||
|
QYWX_ORIGIN = 'qyapi.weixin.qq.com' # 企业微信反向代理地址
|
||||||
QYWX_AM = '' # 企业微信
|
QYWX_AM = '' # 企业微信
|
||||||
QYWX_KEY = '' # 企业微信BOT
|
QYWX_KEY = '' # 企业微信BOT
|
||||||
PUSH_PLUS_TOKEN = '' # 微信推送Plus+
|
PUSH_PLUS_TOKEN = '' # 微信推送Plus+
|
||||||
FS_KEY = '' #飞书群BOT
|
FS_KEY = '' #飞书群BOT
|
||||||
|
|
||||||
|
@ -70,6 +71,8 @@ if "QYWX_AM" in os.environ:
|
||||||
if len(os.environ["QYWX_AM"]) > 1:
|
if len(os.environ["QYWX_AM"]) > 1:
|
||||||
QYWX_AM = os.environ["QYWX_AM"]
|
QYWX_AM = os.environ["QYWX_AM"]
|
||||||
|
|
||||||
|
if "QYWX_ORIGIN" in os.environ and os.environ["QYWX_ORIGIN"]:
|
||||||
|
QYWX_ORIGIN = os.environ["QYWX_ORIGIN"]
|
||||||
|
|
||||||
if "QYWX_KEY" in os.environ:
|
if "QYWX_KEY" in os.environ:
|
||||||
if len(os.environ["QYWX_KEY"]) > 1:
|
if len(os.environ["QYWX_KEY"]) > 1:
|
||||||
|
@ -275,8 +278,8 @@ def wecom_key(title, content):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print(f"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={QYWX_KEY}")
|
print(f"https://{QYWX_ORIGIN}/cgi-bin/webhook/send?key={QYWX_KEY}")
|
||||||
response = requests.post(f"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={QYWX_KEY}", json=data,headers=headers).json()
|
response = requests.post(f"https://{QYWX_ORIGIN}/cgi-bin/webhook/send?key={QYWX_KEY}", json=data,headers=headers).json()
|
||||||
print(response)
|
print(response)
|
||||||
|
|
||||||
# 飞书机器人推送
|
# 飞书机器人推送
|
||||||
|
@ -339,7 +342,7 @@ class WeCom:
|
||||||
self.AGENTID = agentid
|
self.AGENTID = agentid
|
||||||
|
|
||||||
def get_access_token(self):
|
def get_access_token(self):
|
||||||
url = 'https://qyapi.weixin.qq.com/cgi-bin/gettoken'
|
url = 'https://{QYWX_ORIGIN}/cgi-bin/gettoken'
|
||||||
values = {'corpid': self.CORPID,
|
values = {'corpid': self.CORPID,
|
||||||
'corpsecret': self.CORPSECRET,
|
'corpsecret': self.CORPSECRET,
|
||||||
}
|
}
|
||||||
|
@ -348,7 +351,7 @@ class WeCom:
|
||||||
return data["access_token"]
|
return data["access_token"]
|
||||||
|
|
||||||
def send_text(self, message, touser="@all"):
|
def send_text(self, message, touser="@all"):
|
||||||
send_url = 'https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=' + self.get_access_token()
|
send_url = 'https://{QYWX_ORIGIN}/cgi-bin/message/send?access_token=' + self.get_access_token()
|
||||||
send_values = {
|
send_values = {
|
||||||
"touser": touser,
|
"touser": touser,
|
||||||
"msgtype": "text",
|
"msgtype": "text",
|
||||||
|
@ -364,7 +367,7 @@ class WeCom:
|
||||||
return respone["errmsg"]
|
return respone["errmsg"]
|
||||||
|
|
||||||
def send_mpnews(self, title, message, media_id, touser="@all"):
|
def send_mpnews(self, title, message, media_id, touser="@all"):
|
||||||
send_url = 'https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=' + self.get_access_token()
|
send_url = 'https://{QYWX_ORIGIN}/cgi-bin/message/send?access_token=' + self.get_access_token()
|
||||||
send_values = {
|
send_values = {
|
||||||
"touser": touser,
|
"touser": touser,
|
||||||
"msgtype": "mpnews",
|
"msgtype": "mpnews",
|
||||||
|
|
Loading…
Reference in New Issue