x
This commit is contained in:
parent
9a273ffa5f
commit
9d9686e4a9
1
.gitignore
vendored
1
.gitignore
vendored
@ -17,3 +17,4 @@ device.json
|
||||
data/
|
||||
logs/
|
||||
conf/*
|
||||
jdCookie.js
|
||||
@ -342,6 +342,8 @@ var handleMessage = func(msgs ...interface{}) interface{} {
|
||||
}
|
||||
}
|
||||
return fmt.Sprintf("操作成功,%d剩余许愿币%d", id, b)
|
||||
case "run", "执行":
|
||||
runTask(&Task{Path: v}, msgs...)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -45,6 +45,9 @@ var Cdle = false
|
||||
var Config Yaml
|
||||
|
||||
func initConfig() {
|
||||
if ExecPath == "/Users/cdle/Desktop/xdd" {
|
||||
Cdle = true
|
||||
}
|
||||
confDir := ExecPath + "/conf"
|
||||
if _, err := os.Stat(confDir); err != nil {
|
||||
os.MkdirAll(confDir, os.ModePerm)
|
||||
@ -64,7 +67,11 @@ func initConfig() {
|
||||
}
|
||||
f.Close()
|
||||
}
|
||||
content, err := ioutil.ReadFile(ExecPath + "/conf/config.yaml")
|
||||
config := ExecPath + "/conf/config.yaml"
|
||||
if Cdle {
|
||||
config = ExecPath + "/conf/config_cdle.yaml"
|
||||
}
|
||||
content, err := ioutil.ReadFile(config)
|
||||
if err != nil {
|
||||
logs.Warn("解析config.yaml读取错误: %v", err)
|
||||
}
|
||||
@ -80,12 +87,6 @@ func initConfig() {
|
||||
if Config.Qrcode != "" {
|
||||
Config.Theme = Config.Qrcode
|
||||
}
|
||||
//测试
|
||||
if ExecPath == "/Users/cdle/Desktop/xdd" {
|
||||
Cdle = true
|
||||
// Config.QQID = 17745270
|
||||
// Config.QQGroupID = 610790654
|
||||
}
|
||||
if Config.NoGhproxy {
|
||||
GhProxy = ""
|
||||
}
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
)
|
||||
|
||||
func initHandle() {
|
||||
@ -25,6 +29,21 @@ func initHandle() {
|
||||
}
|
||||
}
|
||||
cks = tmp
|
||||
cookies := "{"
|
||||
hh := []string{}
|
||||
for i, ck := range cks {
|
||||
hh = append(hh,
|
||||
fmt.Sprintf("CookieJD%d:'pt_key=%s;pt_pin=%s;'", i+1, ck.PtKey, ck.PtPin),
|
||||
)
|
||||
}
|
||||
cookies += strings.Join(hh, ",")
|
||||
cookies += "}"
|
||||
f, err := os.OpenFile(ExecPath+"/scripts/jdCookie.js", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
logs.Warn("创建jdCookie.js失败,", err)
|
||||
}
|
||||
f.WriteString("module.exports =" + cookies)
|
||||
f.Close()
|
||||
if Config.Mode == Parallel {
|
||||
for i := range Config.Containers {
|
||||
(&Config.Containers[i]).read()
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
@ -32,15 +32,6 @@ type Env struct {
|
||||
|
||||
func initTask() {
|
||||
for i := range Config.Tasks {
|
||||
if Config.Tasks[i].Name == "" {
|
||||
slice := strings.Split(Config.Tasks[i].Path, "/")
|
||||
len := len(slice)
|
||||
if len == 0 {
|
||||
return
|
||||
}
|
||||
Config.Tasks[i].Name = slice[len-1]
|
||||
}
|
||||
// runTask(&Config.Tasks[i])
|
||||
createTask(&Config.Tasks[i])
|
||||
}
|
||||
}
|
||||
@ -58,7 +49,16 @@ func createTask(task *Task) {
|
||||
|
||||
}
|
||||
|
||||
func runTask(task *Task) {
|
||||
func runTask(task *Task, msgs ...interface{}) {
|
||||
if task.Name == "" {
|
||||
slice := strings.Split(task.Path, "/")
|
||||
len := len(slice)
|
||||
if len == 0 {
|
||||
logs.Warn("取法识别的文件名")
|
||||
return
|
||||
}
|
||||
task.Name = slice[len-1]
|
||||
}
|
||||
var path = ExecPath + "/scripts/" + task.Name
|
||||
if strings.Contains(task.Path, "http") {
|
||||
f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
|
||||
@ -86,17 +86,32 @@ func runTask(task *Task) {
|
||||
}
|
||||
sh := fmt.Sprintf(`
|
||||
%s
|
||||
cd %s
|
||||
%s %s
|
||||
`, envs,
|
||||
ExecPath+"/scripts/",
|
||||
lan, task.Name)
|
||||
cmd := exec.Command("sh", "-c", sh)
|
||||
cmd.Stdout = os.Stdout
|
||||
stdout, err := cmd.StdoutPipe()
|
||||
if err != nil {
|
||||
logs.Warn("cmd.StdoutPipe: ", err)
|
||||
return
|
||||
}
|
||||
cmd.Dir = ExecPath + "/scripts/"
|
||||
cmd.Stderr = os.Stderr
|
||||
log.Printf("path: %s", cmd.Path)
|
||||
err := cmd.Run()
|
||||
err = cmd.Start()
|
||||
if err != nil {
|
||||
logs.Warn("%v", err)
|
||||
return
|
||||
}
|
||||
reader := bufio.NewReader(stdout)
|
||||
for {
|
||||
line, err2 := reader.ReadString('\n')
|
||||
if err2 != nil || io.EOF == err2 {
|
||||
break
|
||||
}
|
||||
// if len(msgs) > 0 {
|
||||
sendAdminMessagee(line, msgs...)
|
||||
// }
|
||||
}
|
||||
err = cmd.Wait()
|
||||
return
|
||||
}
|
||||
|
||||
@ -1 +0,0 @@
|
||||
module.exports = {}
|
||||
@ -7,14 +7,13 @@ TG学习交流群https://t.me/cdles
|
||||
const $ = new Env("签到领现金兑换")
|
||||
const ua = `jdltapp;iPhone;3.1.0;${Math.ceil(Math.random()*4+10)}.${Math.ceil(Math.random()*4)};${randomString(40)}`
|
||||
let cookiesArr = []
|
||||
var exchangeAccounts = process.env.exchangeAccounts ?? ""
|
||||
!(async () => {
|
||||
if(exchangeAccounts) {
|
||||
var exchangeAccounts = process.env.exchangeAccounts ? ? ""!(async() => {
|
||||
if (exchangeAccounts) {
|
||||
v = exchangeAccounts.split("&")
|
||||
exchangeAccounts = {}
|
||||
for(var i of v){
|
||||
for (var i of v) {
|
||||
j = i.split("@")
|
||||
exchangeAccounts[j[0]]=j[1] ? +j[1] : 10
|
||||
exchangeAccounts[j[0]] = j[1] ? +j[1] : 10
|
||||
}
|
||||
}
|
||||
await requireConfig()
|
||||
@ -23,20 +22,21 @@ var exchangeAccounts = process.env.exchangeAccounts ?? ""
|
||||
cookie = cookiesArr[i];
|
||||
pt_pin = cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]
|
||||
amount = 0
|
||||
if(exchangeAccounts){
|
||||
if (exchangeAccounts) {
|
||||
amount = exchangeAccounts[pt_pin]
|
||||
if(!amount)continue
|
||||
if (!amount) continue
|
||||
}
|
||||
exchange(cookie,amount,pt_pin)
|
||||
exchange(cookie, amount, pt_pin)
|
||||
}
|
||||
}
|
||||
await $.wait(3000)
|
||||
})()
|
||||
function exchange(cookie,amount,pt_pin) {
|
||||
|
||||
function exchange(cookie, amount, pt_pin) {
|
||||
body = ""
|
||||
if(amount == 2){
|
||||
if (amount == 2) {
|
||||
body = `adid=41CBA646-6EA3-4E79-8623-680F74A5FD7D&body={"type":"2","amount":"200"}&build=167724&client=apple&clientVersion=10.0.6&d_brand=apple&d_model=iPhone10,4&eid=eidI56d7812024s3J0UGWUp+RVK4+9/EY14sMidFB85YSXDSHPI9r07frvvGbXtVFQYuMENUoWFIARXaAYlZNGDyc8dfGQqd42Fer11K0PRjAQjbTBp5&isBackground=N&joycious=79&lang=zh_CN&networkType=wifi&networklibtype=JDNetworkBaseAF&openudid=96ca9290eae9f41770e2c16fd4d07c67eb06b445&osVersion=14.4.2&partner=apple&rfs=0000&scope=10&screen=750*1334&sign=1be417384d1ffccde3dbf6a207277706&st=1625756188161&sv=111&uemps=0-0&uts=0f31TVRjBSsqndu4/jgUPz6uymy50MQJCNy5Ou1kywjunNJYhK2mQzTDwvkNHz8d6J9JA+AN8f7dHT8E/pp+/K+s+/hw3ktfXf7rIWQ3qVqjrVZ8RJpuJJq5WCCsy0wGM2uum+4ppHaNVwnSBrL/ZniFeKJAAxcyCaBFHBfNkP1t3YA8CtB8pQTjm5pvQ/eWyy8qqiBgfB+iPthLx1deRA==&uuid=hjudwgohxzVu96krv/T6Hg==`
|
||||
}else{
|
||||
} else {
|
||||
amount = 10
|
||||
body = `adid=A23D8ECF-B992-477E-BA88-A5E7680DD8F6&body={"type":"2","amount":"1000"}&build=167638&client=apple&clientVersion=9.5.0&eid=eidI5E4E0119RTBCMkMxNEMtNjgxQi00NQ==20v8iy1ivQ9DClEjHXmgvcd5v2MhcsarbJkOkdI5EZKIlK2CiFmfRE6MG017DU87QAHcuwoYwkjGXGws&isBackground=N&joycious=61&lang=zh_CN&networkType=wifi&networklibtype=JDNetworkBaseAF&openudid=3245ad3d16ab2153c69f9ca91cd2e931b06a3bb8&osVersion=13.6.1&rfs=0000&scope=11&screen=1242*2208&sign=427a28328d1650d4c553c1cfdf25744c&st=1618885128891&sv=100&uemps=0-0&uts=0f31TVRjBSsqndu4/jgUPz6uymy50MQJ/+MrMjk4y13kWuMN4VaxQad1iD1QgEcDK/YYLWTuOPAd1akjd5yd8GStO+tvG+FdogNDbDiKjvQgXieBZsBtY63e8GaM2SFD74E/SCZQOKBCgUHo9/gWatL87O9NO0DFzwx44pkT4mA7/S1gDn01AyEbB70wvtsnPtixLxroKuYYDIBNepnJLQ==&uuid=hjudwgohxzVu96krv/T6Hg==`
|
||||
}
|
||||
@ -56,21 +56,21 @@ function exchange(cookie,amount,pt_pin) {
|
||||
}, (err, resp, data) => {
|
||||
try {
|
||||
data = JSON.parse(data)
|
||||
if(data.data){
|
||||
console.log(data.data.bizMsg)
|
||||
if(data.data.bizMsg.indexOf("success")!=-1){
|
||||
if (data.data) {
|
||||
console.log(data.data.bizMsg)
|
||||
if (data.data.bizMsg.indexOf("success") != -1) {
|
||||
data.data.bizMsg = `成功兑换${amount}元红包`
|
||||
}
|
||||
notify.sendNotify(`签到领现金账号 ${decodeURIComponent(pt_pin)}`, data.data.bizMsg);
|
||||
}
|
||||
notify.sendNotify(`签到领现金账号 ${decodeURIComponent(pt_pin)}`, data.data.bizMsg);
|
||||
}
|
||||
if (data.errorMessage) {
|
||||
console.log(data.errorMessage)
|
||||
}
|
||||
if(data.errorMessage){
|
||||
console.log(data.errorMessage)
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr('Error: ', e, resp)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function requireConfig() {
|
||||
return new Promise(resolve => {
|
||||
|
||||
@ -184,18 +184,18 @@ function serverNotify(text, desp, time = 2100) {
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log('发送通知调用API失败!!\n')
|
||||
console.log(err);
|
||||
//console.log('发送通知调用API失败!!\n')
|
||||
//console.log(err);
|
||||
} else {
|
||||
data = JSON.parse(data);
|
||||
//server酱和Server酱·Turbo版的返回json格式不太一样
|
||||
if (data.errno === 0 || data.data.errno === 0) {
|
||||
console.log('server酱发送通知消息成功🎉\n')
|
||||
//console.log('server酱发送通知消息成功🎉\n')
|
||||
} else if (data.errno === 1024) {
|
||||
// 一分钟内发送相同的内容会触发
|
||||
console.log(`server酱发送通知消息异常: ${data.errmsg}\n`)
|
||||
//console.log(`server酱发送通知消息异常: ${data.errmsg}\n`)
|
||||
} else {
|
||||
console.log(`server酱发送通知消息异常\n${JSON.stringify(data)}`)
|
||||
//console.log(`server酱发送通知消息异常\n${JSON.stringify(data)}`)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@ -206,7 +206,7 @@ function serverNotify(text, desp, time = 2100) {
|
||||
})
|
||||
}, time)
|
||||
} else {
|
||||
console.log('\n\n您未提供server酱的SCKEY,取消微信推送消息通知🚫\n');
|
||||
//console.log('\n\n您未提供server酱的SCKEY,取消微信推送消息通知🚫\n');
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
@ -259,18 +259,18 @@ function CoolPush(text, desp) {
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`发送${pushMode(QQ_MODE)}通知调用API失败!!\n`)
|
||||
console.log(err);
|
||||
//console.log(`发送${pushMode(QQ_MODE)}通知调用API失败!!\n`)
|
||||
//console.log(err);
|
||||
} else {
|
||||
data = JSON.parse(data);
|
||||
if (data.code === 200) {
|
||||
console.log(`酷推发送${pushMode(QQ_MODE)}通知消息成功🎉\n`)
|
||||
//console.log(`酷推发送${pushMode(QQ_MODE)}通知消息成功🎉\n`)
|
||||
} else if (data.code === 400) {
|
||||
console.log(`QQ酷推(Cool Push)发送${pushMode(QQ_MODE)}推送失败:${data.msg}\n`)
|
||||
//console.log(`QQ酷推(Cool Push)发送${pushMode(QQ_MODE)}推送失败:${data.msg}\n`)
|
||||
} else if (data.code === 503) {
|
||||
console.log(`QQ酷推出错,${data.message}:${data.data}\n`)
|
||||
//console.log(`QQ酷推出错,${data.message}:${data.data}\n`)
|
||||
} else {
|
||||
console.log(`酷推推送异常: ${JSON.stringify(data)}`);
|
||||
//console.log(`酷推推送异常: ${JSON.stringify(data)}`);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@ -280,7 +280,7 @@ function CoolPush(text, desp) {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('您未提供酷推的SKEY,取消QQ推送消息通知🚫\n');
|
||||
//console.log('您未提供酷推的SKEY,取消QQ推送消息通知🚫\n');
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
@ -299,14 +299,14 @@ function BarkNotify(text, desp, params = {}) {
|
||||
$.get(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log('Bark APP发送通知调用API失败!!\n')
|
||||
console.log(err);
|
||||
//console.log('Bark APP发送通知调用API失败!!\n')
|
||||
//console.log(err);
|
||||
} else {
|
||||
data = JSON.parse(data);
|
||||
if (data.code === 200) {
|
||||
console.log('Bark APP发送通知消息成功🎉\n')
|
||||
//console.log('Bark APP发送通知消息成功🎉\n')
|
||||
} else {
|
||||
console.log(`${data.message}\n`);
|
||||
//console.log(`${data.message}\n`);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@ -316,7 +316,7 @@ function BarkNotify(text, desp, params = {}) {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('您未提供Bark的APP推送BARK_PUSH,取消Bark推送消息通知🚫\n');
|
||||
//console.log('您未提供Bark的APP推送BARK_PUSH,取消Bark推送消息通知🚫\n');
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
@ -349,16 +349,16 @@ function tgBotNotify(text, desp) {
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log('telegram发送通知消息失败!!\n')
|
||||
console.log(err);
|
||||
//console.log('telegram发送通知消息失败!!\n')
|
||||
//console.log(err);
|
||||
} else {
|
||||
data = JSON.parse(data);
|
||||
if (data.ok) {
|
||||
console.log('Telegram发送通知消息成功🎉。\n')
|
||||
//console.log('Telegram发送通知消息成功🎉。\n')
|
||||
} else if (data.error_code === 400) {
|
||||
console.log('请主动给bot发送一条消息并检查接收用户ID是否正确。\n')
|
||||
//console.log('请主动给bot发送一条消息并检查接收用户ID是否正确。\n')
|
||||
} else if (data.error_code === 401) {
|
||||
console.log('Telegram bot token 填写错误。\n')
|
||||
//console.log('Telegram bot token 填写错误。\n')
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@ -368,7 +368,7 @@ function tgBotNotify(text, desp) {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('您未提供telegram机器人推送所需的TG_BOT_TOKEN和TG_USER_ID,取消telegram推送消息通知🚫\n');
|
||||
//console.log('您未提供telegram机器人推送所需的TG_BOT_TOKEN和TG_USER_ID,取消telegram推送消息通知🚫\n');
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
@ -399,14 +399,14 @@ function ddBotNotify(text, desp) {
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log('钉钉发送通知消息失败!!\n')
|
||||
console.log(err);
|
||||
//console.log('钉钉发送通知消息失败!!\n')
|
||||
//console.log(err);
|
||||
} else {
|
||||
data = JSON.parse(data);
|
||||
if (data.errcode === 0) {
|
||||
console.log('钉钉发送通知消息成功🎉。\n')
|
||||
//console.log('钉钉发送通知消息成功🎉。\n')
|
||||
} else {
|
||||
console.log(`${data.errmsg}\n`)
|
||||
//console.log(`${data.errmsg}\n`)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@ -419,14 +419,14 @@ function ddBotNotify(text, desp) {
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log('钉钉发送通知消息失败!!\n')
|
||||
console.log(err);
|
||||
//console.log('钉钉发送通知消息失败!!\n')
|
||||
//console.log(err);
|
||||
} else {
|
||||
data = JSON.parse(data);
|
||||
if (data.errcode === 0) {
|
||||
console.log('钉钉发送通知消息完成。\n')
|
||||
//console.log('钉钉发送通知消息完成。\n')
|
||||
} else {
|
||||
console.log(`${data.errmsg}\n`)
|
||||
//console.log(`${data.errmsg}\n`)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@ -436,7 +436,7 @@ function ddBotNotify(text, desp) {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('您未提供钉钉机器人推送所需的DD_BOT_TOKEN或者DD_BOT_SECRET,取消钉钉推送消息通知🚫\n');
|
||||
//console.log('您未提供钉钉机器人推送所需的DD_BOT_TOKEN或者DD_BOT_SECRET,取消钉钉推送消息通知🚫\n');
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
@ -461,14 +461,14 @@ function qywxBotNotify(text, desp) {
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log('企业微信发送通知消息失败!!\n');
|
||||
console.log(err);
|
||||
//console.log('企业微信发送通知消息失败!!\n');
|
||||
//console.log(err);
|
||||
} else {
|
||||
data = JSON.parse(data);
|
||||
if (data.errcode === 0) {
|
||||
console.log('企业微信发送通知消息成功🎉。\n');
|
||||
//console.log('企业微信发送通知消息成功🎉。\n');
|
||||
} else {
|
||||
console.log(`${data.errmsg}\n`);
|
||||
//console.log(`${data.errmsg}\n`);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@ -478,7 +478,7 @@ function qywxBotNotify(text, desp) {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log('您未提供企业微信机器人推送所需的QYWX_KEY,取消企业微信推送消息通知🚫\n');
|
||||
//console.log('您未提供企业微信机器人推送所需的QYWX_KEY,取消企业微信推送消息通知🚫\n');
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
@ -586,14 +586,14 @@ function qywxamNotify(text, desp) {
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log('成员ID:' + ChangeUserId(desp) + '企业微信应用消息发送通知消息失败!!\n');
|
||||
console.log(err);
|
||||
//console.log('成员ID:' + ChangeUserId(desp) + '企业微信应用消息发送通知消息失败!!\n');
|
||||
//console.log(err);
|
||||
} else {
|
||||
data = JSON.parse(data);
|
||||
if (data.errcode === 0) {
|
||||
console.log('成员ID:' + ChangeUserId(desp) + '企业微信应用消息发送通知消息成功🎉。\n');
|
||||
//console.log('成员ID:' + ChangeUserId(desp) + '企业微信应用消息发送通知消息成功🎉。\n');
|
||||
} else {
|
||||
console.log(`${data.errmsg}\n`);
|
||||
//console.log(`${data.errmsg}\n`);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@ -604,7 +604,7 @@ function qywxamNotify(text, desp) {
|
||||
});
|
||||
});
|
||||
} else {
|
||||
console.log('您未提供企业微信应用消息推送所需的QYWX_AM,取消企业微信应用消息推送消息通知🚫\n');
|
||||
//console.log('您未提供企业微信应用消息推送所需的QYWX_AM,取消企业微信应用消息推送消息通知🚫\n');
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
@ -616,7 +616,7 @@ function iGotNotify(text, desp, params = {}) {
|
||||
// 校验传入的IGOT_PUSH_KEY是否有效
|
||||
const IGOT_PUSH_KEY_REGX = new RegExp("^[a-zA-Z0-9]{24}$")
|
||||
if (!IGOT_PUSH_KEY_REGX.test(IGOT_PUSH_KEY)) {
|
||||
console.log('您所提供的IGOT_PUSH_KEY无效\n')
|
||||
//console.log('您所提供的IGOT_PUSH_KEY无效\n')
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
@ -631,14 +631,14 @@ function iGotNotify(text, desp, params = {}) {
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log('发送通知调用API失败!!\n')
|
||||
console.log(err);
|
||||
//console.log('发送通知调用API失败!!\n')
|
||||
//console.log(err);
|
||||
} else {
|
||||
if (typeof data === 'string') data = JSON.parse(data);
|
||||
if (data.ret === 0) {
|
||||
console.log('iGot发送通知消息成功🎉\n')
|
||||
//console.log('iGot发送通知消息成功🎉\n')
|
||||
} else {
|
||||
console.log(`iGot发送通知消息失败:${data.errMsg}\n`)
|
||||
//console.log(`iGot发送通知消息失败:${data.errMsg}\n`)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@ -648,7 +648,7 @@ function iGotNotify(text, desp, params = {}) {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('您未提供iGot的推送IGOT_PUSH_KEY,取消iGot推送消息通知🚫\n');
|
||||
//console.log('您未提供iGot的推送IGOT_PUSH_KEY,取消iGot推送消息通知🚫\n');
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
@ -675,14 +675,14 @@ function pushPlusNotify(text, desp) {
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`push+发送${PUSH_PLUS_USER ? '一对多' : '一对一'}通知消息失败!!\n`)
|
||||
console.log(err);
|
||||
//console.log(`push+发送${PUSH_PLUS_USER ? '一对多' : '一对一'}通知消息失败!!\n`)
|
||||
//console.log(err);
|
||||
} else {
|
||||
data = JSON.parse(data);
|
||||
if (data.code === 200) {
|
||||
console.log(`push+发送${PUSH_PLUS_USER ? '一对多' : '一对一'}通知消息完成。\n`)
|
||||
//console.log(`push+发送${PUSH_PLUS_USER ? '一对多' : '一对一'}通知消息完成。\n`)
|
||||
} else {
|
||||
console.log(`push+发送${PUSH_PLUS_USER ? '一对多' : '一对一'}通知消息失败:${data.msg}\n`)
|
||||
//console.log(`push+发送${PUSH_PLUS_USER ? '一对多' : '一对一'}通知消息失败:${data.msg}\n`)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@ -692,7 +692,7 @@ function pushPlusNotify(text, desp) {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('您未提供push+推送所需的PUSH_PLUS_TOKEN,取消push+推送消息通知🚫\n');
|
||||
//console.log('您未提供push+推送所需的PUSH_PLUS_TOKEN,取消push+推送消息通知🚫\n');
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
@ -812,7 +812,9 @@ function Env(t, s) {
|
||||
const h = t => !t || !this.isLoon() && this.isSurge() ? t : "string" == typeof t ? this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : void 0 : "object" == typeof t && (t["open-url"] || t["media-url"]) ? this.isLoon() ? t["open-url"] : this.isQuanX() ? t : void 0 : void 0;
|
||||
$.isMute || (this.isSurge() || this.isLoon() ? $notification.post(s, e, i, h(o)) : this.isQuanX() && $notify(s, e, i, h(o))), this.logs.push("", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="), this.logs.push(s), e && this.logs.push(e), i && this.logs.push(i)
|
||||
}
|
||||
log(...t) { t.length > 0 ? this.logs = [...this.logs, ...t] : console.log(this.logs.join(this.logSeparator)) }
|
||||
log(...t) {
|
||||
t.length > 0 ? this.logs = [...this.logs, ...t] : console.log(this.logs.join(this.logSeparator))
|
||||
}
|
||||
logErr(t, s) {
|
||||
const e = !this.isSurge() && !this.isQuanX() && !this.isLoon();
|
||||
e ? $.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : $.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user