fix jd_redPacket.js

This commit is contained in:
lxk0301
2021-04-03 19:29:20 +08:00
parent 258343a180
commit 20cf187576
2 changed files with 16 additions and 13 deletions

File diff suppressed because one or more lines are too long

View File

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