KingRan 2022-02-24 18:27:19 +08:00
parent 93f8d7db1e
commit 4f13ddad92
1 changed files with 18 additions and 5 deletions

View File

@ -40,6 +40,7 @@ let cookiesArr = [], cookie = '', token = '';
let UA, UAInfo = {}; let UA, UAInfo = {};
const randomCount = $.isNode() ? 20 : 3; const randomCount = $.isNode() ? 20 : 3;
$.appId = "92a36"; $.appId = "92a36";
let lnrun = 0;
function oc(fn, defaultVal) {//optioanl chaining function oc(fn, defaultVal) {//optioanl chaining
try { try {
return fn() return fn()
@ -89,15 +90,22 @@ if ($.isNode()) {
$.allTask = [] $.allTask = []
$.info = {} $.info = {}
token = await getJxToken() token = await getJxToken()
await cfd(); lnrun++;
await $.wait(3000); await cfd();
await $.wait(2000);
if (lnrun == 10) {
console.log(`\n【访问接口次数达到10次休息半分钟.....】\n`);
await $.wait(30 * 1000);
lnrun = 0;
}
} }
} }
let res = await getAuthorShareCode('https://gitee.com/KingRan521/JD-Scripts/raw/master/shareCodes/cfd.json') let res = await getAuthorShareCode('https://gitee.com/KingRan521/JD-Scripts/raw/master/shareCodes/cfd.json')
$.strMyShareIds = [...(res || [])] $.strMyShareIds = [...(res || [])]
await shareCodesFormat() await shareCodesFormat()
for (let i = 0; i < cookiesArr.length; i++) { for (let i = 0; i < cookiesArr.length; i++) {
cookie = cookiesArr[i]; lnrun++;
cookie = cookiesArr[i];
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]) $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
$.canHelp = true $.canHelp = true
UA = UAInfo[$.UserName] UA = UAInfo[$.UserName]
@ -106,7 +114,7 @@ if ($.isNode()) {
for (let j = 0; j < $.newShareCodes.length && $.canHelp; j++) { for (let j = 0; j < $.newShareCodes.length && $.canHelp; j++) {
console.log(`账号${$.UserName} 去助力 ${$.newShareCodes[j]}`) console.log(`账号${$.UserName} 去助力 ${$.newShareCodes[j]}`)
$.delcode = false $.delcode = false
await helpByStage($.newShareCodes[j]) await helpByStage($.newShareCodes[j])
await $.wait(2000) await $.wait(2000)
if ($.delcode) { if ($.delcode) {
$.newShareCodes.splice(j, 1) $.newShareCodes.splice(j, 1)
@ -117,6 +125,11 @@ if ($.isNode()) {
} else { } else {
break break
} }
if (lnrun == 5) {
console.log(`\n【访问接口次数达到5次休息半分钟.....】\n`);
await $.wait(30 * 1000);
lnrun = 0;
}
} }
await showMsg(); await showMsg();
})() })()
@ -1463,7 +1476,7 @@ function shareCodesFormat() {
} else { } else {
$.newShareCodes = [...new Set([...$.shareCodes, ...$.strMyShareIds])]; $.newShareCodes = [...new Set([...$.shareCodes, ...$.strMyShareIds])];
} }
console.log(`您将要助力的好友${JSON.stringify($.newShareCodes)}`) console.log(`\n\n您将要助力的好友${JSON.stringify($.newShareCodes)}`)
resolve(); resolve();
}) })
} }