fix jd_redPacket.js
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -2,7 +2,7 @@
|
|||||||
* @Author: lxk0301 https://gitee.com/lxk0301
|
* @Author: lxk0301 https://gitee.com/lxk0301
|
||||||
* @Date: 2020-08-19 16:12:40
|
* @Date: 2020-08-19 16:12:40
|
||||||
* @Last Modified by: lxk0301
|
* @Last Modified by: lxk0301
|
||||||
* @Last Modified time: 2021-3-29 11:52:54
|
* @Last Modified time: 2021-4-3 16:00:54
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* sendNotify 推送通知功能
|
* sendNotify 推送通知功能
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
const querystring = require("querystring");
|
const querystring = require("querystring");
|
||||||
const $ = new Env();
|
const $ = new Env();
|
||||||
|
const timeout = 15000;//超时时间(单位毫秒)
|
||||||
// =======================================微信server酱通知设置区域===========================================
|
// =======================================微信server酱通知设置区域===========================================
|
||||||
//此处填你申请的SCKEY.
|
//此处填你申请的SCKEY.
|
||||||
//(环境变量名 PUSH_KEY)
|
//(环境变量名 PUSH_KEY)
|
||||||
@@ -170,7 +171,7 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本脚本免费
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
function serverNotify(text, desp, timeout = 2100) {
|
function serverNotify(text, desp, time = 2100) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if (SCKEY) {
|
if (SCKEY) {
|
||||||
//微信server酱推送通知一个\n不会换行,需要两个\n才能换行,故做此替换
|
//微信server酱推送通知一个\n不会换行,需要两个\n才能换行,故做此替换
|
||||||
@@ -181,7 +182,7 @@ function serverNotify(text, desp, timeout = 2100) {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
},
|
},
|
||||||
timeout: 10000
|
timeout
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$.post(options, (err, resp, data) => {
|
$.post(options, (err, resp, data) => {
|
||||||
@@ -207,7 +208,7 @@ function serverNotify(text, desp, timeout = 2100) {
|
|||||||
resolve(data);
|
resolve(data);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, timeout)
|
}, time)
|
||||||
} else {
|
} else {
|
||||||
console.log('\n\n您未提供server酱的SCKEY,取消微信推送消息通知🚫\n');
|
console.log('\n\n您未提供server酱的SCKEY,取消微信推送消息通知🚫\n');
|
||||||
resolve()
|
resolve()
|
||||||
@@ -297,7 +298,7 @@ function BarkNotify(text, desp, params={}) {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
},
|
},
|
||||||
timeout: 10000
|
timeout
|
||||||
}
|
}
|
||||||
$.get(options, (err, resp, data) => {
|
$.get(options, (err, resp, data) => {
|
||||||
try {
|
try {
|
||||||
@@ -334,7 +335,7 @@ function tgBotNotify(text, desp) {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
},
|
},
|
||||||
timeout: 10000
|
timeout
|
||||||
}
|
}
|
||||||
if (TG_PROXY_HOST && TG_PROXY_PORT) {
|
if (TG_PROXY_HOST && TG_PROXY_PORT) {
|
||||||
const tunnel = require("tunnel");
|
const tunnel = require("tunnel");
|
||||||
@@ -389,7 +390,7 @@ function ddBotNotify(text, desp) {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
timeout: 10000
|
timeout
|
||||||
}
|
}
|
||||||
if (DD_BOT_TOKEN && DD_BOT_SECRET) {
|
if (DD_BOT_TOKEN && DD_BOT_SECRET) {
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
@@ -457,7 +458,7 @@ function qywxBotNotify(text, desp) {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
timeout: 10000
|
timeout
|
||||||
};
|
};
|
||||||
if (QYWX_KEY) {
|
if (QYWX_KEY) {
|
||||||
$.post(options, (err, resp, data) => {
|
$.post(options, (err, resp, data) => {
|
||||||
@@ -518,7 +519,7 @@ function qywxamNotify(text, desp) {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
timeout: 10000
|
timeout
|
||||||
};
|
};
|
||||||
$.post(options_accesstoken, (err, resp, data) => {
|
$.post(options_accesstoken, (err, resp, data) => {
|
||||||
html = desp.replace(/\n/g, "<br/>")
|
html = desp.replace(/\n/g, "<br/>")
|
||||||
@@ -630,7 +631,7 @@ function iGotNotify(text, desp, params={}){
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
},
|
},
|
||||||
timeout: 10000
|
timeout
|
||||||
}
|
}
|
||||||
$.post(options, (err, resp, data) => {
|
$.post(options, (err, resp, data) => {
|
||||||
try {
|
try {
|
||||||
@@ -674,7 +675,7 @@ function pushPlusNotify(text, desp) {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': ' application/json'
|
'Content-Type': ' application/json'
|
||||||
},
|
},
|
||||||
timeout: 10000
|
timeout
|
||||||
}
|
}
|
||||||
$.post(options, (err, resp, data) => {
|
$.post(options, (err, resp, data) => {
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user