KingRan 2022-02-16 11:46:39 +08:00
parent 62ef1a14f0
commit 1613a6f31a
3 changed files with 65 additions and 68 deletions

View File

@ -20,7 +20,7 @@ export CKNOWARNERROR="true"
## 屏蔽青龙登陆成功通知登陆失败不屏蔽 ## 屏蔽青龙登陆成功通知登陆失败不屏蔽
export NOTIFY_NOLOGINSUCCESS="true" export NOTIFY_NOLOGINSUCCESS="true"
## 通知底部显示 ## 通知底部显示
export NOTIFY_AUTHOR="来源于https://github.com/KingRan/JDJB" export NOTIFY_AUTHOR="来源于https://github.com/KingRan/KR"
## 增加NOTIFY_AUTHOR_BLANK 环境变量控制不显示底部信息 ## 增加NOTIFY_AUTHOR_BLANK 环境变量控制不显示底部信息
export NOTIFY_AUTHOR_BLANK="true" export NOTIFY_AUTHOR_BLANK="true"
## 增加NOTIFY_AUTOCHECKCK为true才开启通知脚本内置的自动禁用过期ck ## 增加NOTIFY_AUTOCHECKCK为true才开启通知脚本内置的自动禁用过期ck
@ -189,7 +189,7 @@ if (process.env.NOTIFY_SHOWNAMETYPE) {
if (ShowRemarkType == "4") if (ShowRemarkType == "4")
console.log("检测到显示备注名称,格式为: 备注"); console.log("检测到显示备注名称,格式为: 备注");
} }
async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By https://github.com/KingRan/JDJB',strsummary="") { async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By https://github.com/KingRan/KR',strsummary="") {
console.log(`开始发送通知...`); console.log(`开始发送通知...`);
if (process.env.NOTIFY_FILTERBYFILE) { if (process.env.NOTIFY_FILTERBYFILE) {

View File

@ -415,7 +415,7 @@ if(DisableIndex!=-1){
await notify.sendNotify(`${$.name}`, `${allMessage}`, { await notify.sendNotify(`${$.name}`, `${allMessage}`, {
url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean`
}, '\n\n本通知 By https://github.com/KingRan/JDJB',TempMessage) }, '\n\n本通知 By https://github.com/KingRan/KR',TempMessage)
} }
if ($.isNode() && allMessageMonth) { if ($.isNode() && allMessageMonth) {
await notify.sendNotify(`京东月资产变动`, `${allMessageMonth}`, { await notify.sendNotify(`京东月资产变动`, `${allMessageMonth}`, {
@ -484,7 +484,7 @@ if(DisableIndex!=-1){
await notify.sendNotify(`${$.name}`, `${allMessage}`, { await notify.sendNotify(`${$.name}`, `${allMessage}`, {
url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean`
}, '\n\n本通知 By https://github.com/KingRan/JDJB',TempMessage) }, '\n\n本通知 By https://github.com/KingRan/KR',TempMessage)
} }
if ($.isNode() && allMessageMonth) { if ($.isNode() && allMessageMonth) {
await notify.sendNotify(`京东月资产变动`, `${allMessageMonth}`, { await notify.sendNotify(`京东月资产变动`, `${allMessageMonth}`, {
@ -500,7 +500,7 @@ if(DisableIndex!=-1){
allMessageGp2=strAllNotify+`\n`+allMessageGp2; allMessageGp2=strAllNotify+`\n`+allMessageGp2;
await notify.sendNotify(`${$.name}#2`, `${allMessageGp2}`, { await notify.sendNotify(`${$.name}#2`, `${allMessageGp2}`, {
url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean`
}, '\n\n本通知 By https://github.com/KingRan/JDJB',TempMessage) }, '\n\n本通知 By https://github.com/KingRan/KR',TempMessage)
await $.wait(10 * 1000); await $.wait(10 * 1000);
} }
if ($.isNode() && allMessageGp3) { if ($.isNode() && allMessageGp3) {
@ -509,7 +509,7 @@ if(DisableIndex!=-1){
allMessageGp3=strAllNotify+`\n`+allMessageGp3; allMessageGp3=strAllNotify+`\n`+allMessageGp3;
await notify.sendNotify(`${$.name}#3`, `${allMessageGp3}`, { await notify.sendNotify(`${$.name}#3`, `${allMessageGp3}`, {
url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean`
}, '\n\n本通知 By https://github.com/KingRan/JDJB',TempMessage) }, '\n\n本通知 By https://github.com/KingRan/KR',TempMessage)
await $.wait(10 * 1000); await $.wait(10 * 1000);
} }
if ($.isNode() && allMessageGp4) { if ($.isNode() && allMessageGp4) {
@ -518,7 +518,7 @@ if(DisableIndex!=-1){
allMessageGp4=strAllNotify+`\n`+allMessageGp4; allMessageGp4=strAllNotify+`\n`+allMessageGp4;
await notify.sendNotify(`${$.name}#4`, `${allMessageGp4}`, { await notify.sendNotify(`${$.name}#4`, `${allMessageGp4}`, {
url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean`
}, '\n\n本通知 By https://github.com/KingRan/JDJB',TempMessage) }, '\n\n本通知 By https://github.com/KingRan/KR',TempMessage)
await $.wait(10 * 1000); await $.wait(10 * 1000);
} }
if ($.isNode() && allMessage) { if ($.isNode() && allMessage) {
@ -528,7 +528,7 @@ if(DisableIndex!=-1){
await notify.sendNotify(`${$.name}`, `${allMessage}`, { await notify.sendNotify(`${$.name}`, `${allMessage}`, {
url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean`
}, '\n\n本通知 By https://github.com/KingRan/JDJB',TempMessage) }, '\n\n本通知 By https://github.com/KingRan/KR',TempMessage)
await $.wait(10 * 1000); await $.wait(10 * 1000);
} }
@ -978,7 +978,7 @@ async function showMsg() {
if(strAllNotify) if(strAllNotify)
ReturnMessage=strAllNotify+`\n`+ReturnMessage; ReturnMessage=strAllNotify+`\n`+ReturnMessage;
await notify.sendNotifybyWxPucher(strTitle, `${ReturnMessage}`, `${$.UserName}`,'\n\n本通知 By https://github.com/KingRan/JDJB',strsummary); await notify.sendNotifybyWxPucher(strTitle, `${ReturnMessage}`, `${$.UserName}`,'\n\n本通知 By https://github.com/KingRan/KR',strsummary);
} }
//$.msg($.name, '', ReturnMessage , {"open-url": "https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean"}); //$.msg($.name, '', ReturnMessage , {"open-url": "https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean"});
@ -1134,22 +1134,21 @@ async function Monthbean() {
async function jdCash() { async function jdCash() {
let functionId = "cash_homePage"; let functionId = "cash_homePage";
let body = "%7B%7D"; let body = {};
let uuid = randomString(16);
console.log(`正在获取领现金任务签名...`); console.log(`正在获取领现金任务签名...`);
isSignError = false; isSignError = false;
let sign = await getSign(functionId, decodeURIComponent(body), uuid) let sign = await getSign(functionId, body);
if (isSignError) { if (isSignError) {
console.log(`领现金任务签名获取失败,等待2秒后再次尝试...`) console.log(`领现金任务签名获取失败,等待2秒后再次尝试...`)
await $.wait(2 * 1000); await $.wait(2 * 1000);
isSignError = false; isSignError = false;
sign = await getSign(functionId, decodeURIComponent(body), uuid); sign =await getSign(functionId, body);
} }
if (isSignError) { if (isSignError) {
console.log(`领现金任务签名获取失败,等待2秒后再次尝试...`) console.log(`领现金任务签名获取失败,等待2秒后再次尝试...`)
await $.wait(2 * 1000); await $.wait(2 * 1000);
isSignError = false; isSignError = false;
sign = await getSign(functionId, decodeURIComponent(body), uuid); sign = await getSign(functionId, body);
} }
if (!isSignError) { if (!isSignError) {
console.log(`领现金任务签名获取成功...`) console.log(`领现金任务签名获取成功...`)
@ -1158,9 +1157,8 @@ async function jdCash() {
$.jdCash = 0; $.jdCash = 0;
return return
} }
let url = `${JD_API_HOST}?functionId=${functionId}&build=167774&client=apple&clientVersion=10.1.0&uuid=${uuid}&${sign}`
return new Promise((resolve) => { return new Promise((resolve) => {
$.post(apptaskUrl(url, body), async(err, resp, data) => { $.post(apptaskUrl(functionId, sign), async (err, resp, data) => {
try { try {
if (err) { if (err) {
console.log(`${JSON.stringify(err)}`) console.log(`${JSON.stringify(err)}`)
@ -1183,57 +1181,56 @@ async function jdCash() {
}) })
}) })
} }
function apptaskUrl(url, body) { function apptaskUrl(functionId = "", body = "") {
return { return {
url, url: `${JD_API_HOST}?functionId=${functionId}`,
body: `body=${body}`, body,
headers: { headers: {
'Cookie': cookie, 'Cookie': cookie,
'Host': 'api.m.jd.com', 'Host': 'api.m.jd.com',
'Connection': 'keep-alive', 'Connection': 'keep-alive',
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
'Referer': '', 'Referer': '',
'User-Agent': 'JD4iPhone/167774 (iPhone; iOS 14.7.1; Scale/3.00)', 'User-Agent': 'JD4iPhone/167774 (iPhone; iOS 14.7.1; Scale/3.00)',
'Accept-Language': 'zh-Hans-CN;q=1', 'Accept-Language': 'zh-Hans-CN;q=1',
'Accept-Encoding': 'gzip, deflate, br', 'Accept-Encoding': 'gzip, deflate, br',
} }
} }
} }
function getSign(functionid, body, uuid) { function getSign(functionId, body) {
return new Promise(async resolve => { return new Promise(async resolve => {
let data = { let data = {
"functionId": functionid, functionId,
"body": body, body: JSON.stringify(body),
"uuid": uuid, "client":"apple",
"client": "apple", "clientVersion":"10.3.0"
"clientVersion": "10.1.0" }
} let HostArr = ['jdsign.cf', 'signer.nz.lu']
let HostArr = ['jdsign.cf', 'signer.nz.lu'] let Host = HostArr[Math.floor((Math.random() * HostArr.length))]
let Host = HostArr[Math.floor((Math.random() * HostArr.length))] let options = {
let options = { url: `https://cdn.nz.lu/ddo`,
url: `https://cdn.nz.lu/ddo`, body: JSON.stringify(data),
body: JSON.stringify(data), headers: {
headers: { Host,
Host, "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/87.0.4280.88"
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/87.0.4280.88" },
}, timeout: 30 * 1000
timeout: 15000 }
} $.post(options, (err, resp, data) => {
$.post(options, (err, resp, data) => { try {
try { if (err) {
if (err) { console.log(JSON.stringify(err))
console.log(`${JSON.stringify(err)}`); console.log(`${$.name} getSign API请求失败请检查网路重试`)
isSignError = true; } else {
//console.log(`${$.name} getSign API请求失败请检查网路重试`)
} else {} }
} catch (e) { } catch (e) {
$.logErr(e, resp) $.logErr(e, resp)
} } finally {
finally { resolve(data);
resolve(data); }
} })
}) })
})
} }
function TotalBean() { function TotalBean() {
return new Promise(async resolve => { return new Promise(async resolve => {

View File

@ -20,7 +20,7 @@ export CKNOWARNERROR="true"
## 屏蔽青龙登陆成功通知登陆失败不屏蔽 ## 屏蔽青龙登陆成功通知登陆失败不屏蔽
export NOTIFY_NOLOGINSUCCESS="true" export NOTIFY_NOLOGINSUCCESS="true"
## 通知底部显示 ## 通知底部显示
export NOTIFY_AUTHOR="来源于https://github.com/KingRan/JDJB" export NOTIFY_AUTHOR="来源于https://github.com/KingRan/KR"
## 增加NOTIFY_AUTHOR_BLANK 环境变量控制不显示底部信息 ## 增加NOTIFY_AUTHOR_BLANK 环境变量控制不显示底部信息
export NOTIFY_AUTHOR_BLANK="true" export NOTIFY_AUTHOR_BLANK="true"
## 增加NOTIFY_AUTOCHECKCK为true才开启通知脚本内置的自动禁用过期ck ## 增加NOTIFY_AUTOCHECKCK为true才开启通知脚本内置的自动禁用过期ck
@ -189,7 +189,7 @@ if (process.env.NOTIFY_SHOWNAMETYPE) {
if (ShowRemarkType == "4") if (ShowRemarkType == "4")
console.log("检测到显示备注名称,格式为: 备注"); console.log("检测到显示备注名称,格式为: 备注");
} }
async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By https://github.com/KingRan/JDJB',strsummary="") { async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By https://github.com/KingRan/KR',strsummary="") {
console.log(`开始发送通知...`); console.log(`开始发送通知...`);
if (process.env.NOTIFY_FILTERBYFILE) { if (process.env.NOTIFY_FILTERBYFILE) {