This commit is contained in:
Faker
2022-03-28 17:49:06 +08:00
parent b99e82337a
commit 95c575c797
8 changed files with 1050 additions and 481 deletions

View File

@@ -14,7 +14,7 @@ const querystring = require('querystring');
const exec = require('child_process').exec;
const $ = new Env();
const timeout = 15000; //超时时间(单位毫秒)
console.log("加载sendNotify当前版本: 20220306");
console.log("加载sendNotify当前版本: 20220327");
// =======================================go-cqhttp通知设置区域===========================================
//gobot_url 填写请求地址http://127.0.0.1/send_private_msg
//gobot_token 填写在go-cqhttp文件设置的访问密钥
@@ -132,7 +132,18 @@ const {
getEnvByPtPin
} = require('./ql');
const fs = require('fs');
let strCKFile = '/ql/scripts/CKName_cache.json';
let isnewql = fs.existsSync('/ql/data/config/auth.json');
let strCKFile="";
let strUidFile ="";
if(isnewql){
strCKFile = '/ql/data/scripts/CKName_cache.json';
strUidFile = '/ql/data/scripts/CK_WxPusherUid.json';
}else{
strCKFile = '/ql/scripts/CKName_cache.json';
strUidFile = '/ql/scripts/CK_WxPusherUid.json';
}
let Fileexists = fs.existsSync(strCKFile);
let TempCK = [];
if (Fileexists) {
@@ -143,7 +154,7 @@ if (Fileexists) {
TempCK = JSON.parse(TempCK);
}
}
let strUidFile = '/ql/scripts/CK_WxPusherUid.json';
let UidFileexists = fs.existsSync(strUidFile);
let TempCKUid = [];
if (UidFileexists) {
@@ -1442,7 +1453,11 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By cc
$.nickName = $.nickName.replace(new RegExp(`[*]`, 'gm'), "[*]");
text = text.replace(new RegExp(`${$.UserName}|${$.nickName}`, 'gm'), $.Remark);
if (text == "京东资产变动" || text == "京东资产变动#2" || text == "京东资产变动#3" || text == "京东资产变动#4") {
var Tempinfo = getQLinfo(cookie, envs[i].created, envs[i].timestamp, envs[i].remarks);
var Tempinfo = "";
if(envs[i].created)
Tempinfo=getQLinfo(cookie, envs[i].created, envs[i].timestamp, envs[i].remarks);
else
Tempinfo=getQLinfo(cookie, envs[i].createdAt, envs[i].timestamp, envs[i].remarks);
if (Tempinfo) {
$.Remark += Tempinfo;
}
@@ -1696,7 +1711,12 @@ async function sendNotifybyWxPucher(text, desp, PtPin, author = '\n\n本通知 B
//额外处理1nickName包含星号
$.nickName = $.nickName.replace(new RegExp(`[*]`, 'gm'), "[*]");
var Tempinfo = getQLinfo(cookie, tempEnv.created, tempEnv.timestamp, tempEnv.remarks);
var Tempinfo = "";
if(tempEnv.created)
Tempinfo=getQLinfo(cookie, tempEnv.created, tempEnv.timestamp, tempEnv.remarks);
else
Tempinfo=getQLinfo(cookie, tempEnv.createdAt, tempEnv.timestamp, tempEnv.remarks);
if (Tempinfo) {
Tempinfo = $.nickName + Tempinfo;
desp = desp.replace(new RegExp(`${$.UserName}|${$.nickName}`, 'gm'), Tempinfo);