fix: SCKEY和PUSH_PLUS_TOKEN须为长度大于5的字符串

This commit is contained in:
shanmite 2021-02-21 18:24:48 +08:00
parent 9021374f60
commit ec91e97568
2 changed files with 32 additions and 32 deletions

View File

@ -110,8 +110,8 @@ Chrome浏览器:
### 检测中奖
每两个小时检测一次
通过`@`信息判断
通过私信判断(恭喜|中奖|地址|支付宝|账号|收款码)
*关键词有限 可能会有漏掉的*
通过私信判断(|中奖|地址|支付宝|账号|收款码)
*关键词有限 可能会有漏掉的或误报*
#### 手动检查
手动触发`Automatic check`工作流后可在日志中查看

View File

@ -13,21 +13,21 @@ const Monitor = require('./Monitor');
*/
const ServerChan = (text, desp) => {
const { SCKEY } = GlobalVar;
if (SCKEY === '') {
if (typeof SCKEY === 'string' && SCKEY.length > 5) {
Ajax.get({
url: `https://sc.ftqq.com/${SCKEY}.send`,
queryStringsObj: {
text,
desp
},
success: responseText => {
console.log(responseText);
if (JSON.parse(responseText).errno !== 0) throw new Error("ServerChan通知失败")
}
})
} else {
console.log(`未填写SCKEY\n${desp}`)
return;
}
Ajax.get({
url: `https://sc.ftqq.com/${SCKEY}.send`,
queryStringsObj: {
text,
desp
},
success: responseText => {
console.log(responseText);
if (JSON.parse(responseText).errno !== 0) throw new Error("ServerChan通知失败")
}
})
}
/**
@ -37,22 +37,22 @@ const ServerChan = (text, desp) => {
*/
const pushplus = (text, desp) => {
const { PUSH_PLUS_TOKEN } = GlobalVar;
if (PUSH_PLUS_TOKEN === '') {
if (typeof PUSH_PLUS_TOKEN === 'string' && PUSH_PLUS_TOKEN.length > 5) {
Ajax.get({
url: `http://pushplus.hxtrip.com/send`,
queryStringsObj: {
token: PUSH_PLUS_TOKEN,
title: text,
content: desp
},
success: responseText => {
console.log(responseText);
if (JSON.parse(responseText).code !== 200) throw new Error("pushplus通知失败")
}
})
} else {
console.log(`未填写PUSH_PLUS_TOKEN\n${desp}`)
return;
}
Ajax.get({
url: `http://pushplus.hxtrip.com/send`,
queryStringsObj: {
token: PUSH_PLUS_TOKEN,
title: text,
content: desp
},
success: responseText => {
console.log(responseText);
if (JSON.parse(responseText).code !== 200) throw new Error("pushplus通知失败")
}
})
}
/**
@ -105,16 +105,16 @@ async function isMe() {
let max = 0;
do {
MySession.data.forEach(Session => {
const {content, sender_uid, session_ts, timestamp} = Session;
const { content, sender_uid, session_ts, timestamp } = Session;
session_t = session_ts;
if ((Date.now() / 1000 - timestamp) / 3600 >= 2) {
return;
}
if (/恭喜|中奖|地址|支付宝|账号|收款码/.test(content)) {
if (/?奖|地址|支付宝|账号|收款码/.test(content)) {
desp += `发生时间: ${transformTimeZone(timestamp * 1000, 8)} <br><br>`
desp += `用户: ${sender_uid} <br><br>`
desp += `私信你(${GlobalVar.myUID})说: ${content} <br><br>`
desp += `[直达链接](https://message.bilibili.com/#/whisper/mid${sender_uid})`
desp += `[直达链接](https://message.bilibili.com/#/whisper/mid${sender_uid}) <br><br>`
desp += `--------------------- <br><br>`
}
})