This commit is contained in:
Faker 2022-06-08 16:17:12 +08:00
parent bc0d774295
commit 888ccc0451
4 changed files with 2494 additions and 1668 deletions

File diff suppressed because one or more lines are too long

View File

@ -10,16 +10,17 @@
==========================Quantumultx=========================
[task_local]
#jd免费水果
10 5,17 * * * jd_fruit_friend.js, tag=东东农场好友删减奖励, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdnc.png, enabled=true
10 2 * * * jd_fruit_friend.js, tag=东东农场好友删减奖励, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdnc.png, enabled=true
=========================Loon=============================
[Script]
cron "10 5,17 * * *" script-path=jd_fruit_friend.js,tag=东东农场好友删减奖励
cron "10 2 * * *" script-path=jd_fruit_friend.js,tag=东东农场好友删减奖励
=========================Surge============================
东东农场好友删减奖励 = type=cron,cronexp="10 5,17 * * *",wake-system=1,timeout=3600,script-path=jd_fruit_friend.js
东东农场好友删减奖励 = type=cron,cronexp="10 2 * * *",wake-system=1,timeout=3600,script-path=jd_fruit_friend.js
=========================小火箭===========================
东东农场好友删减奖励 = type=cron,script-path=jd_fruit_friend.js, cronexpr="10 5,17 * * *", timeout=3600, enable=true
东东农场好友删减奖励 = type=cron,script-path=jd_fruit_friend.js, cronexpr="10 2 * * *", timeout=3600, enable=true
*/
const $ = new Env('东东农场好友删减奖励');
@ -33,6 +34,21 @@ const JD_API_HOST = 'https://api.m.jd.com/client.action';
const urlSchema = `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/3KSjXqQabiTuD1cJ28QskrpWoBKT/index.html%22%20%7D`;
let NowHour = new Date().getHours();
let llhelp = true;
const fs = require('fs');
let boolneedUpdate = false;
let strShare = './Fruit_ShareCache.json';
let Fileexists = fs.existsSync(strShare);
let TempShareCache = [];
if (Fileexists) {
console.log("检测到东东农场缓存文件Fruit_ShareCache.json载入...");
TempShareCache = fs.readFileSync(strShare, 'utf-8');
if (TempShareCache) {
TempShareCache = TempShareCache.toString();
TempShareCache = JSON.parse(TempShareCache);
}
}
let lnrun = 0;
let llgetshare = false;
!(async () => {
await requireConfig();
if (!cookiesArr[0]) {
@ -40,7 +56,7 @@ let llhelp=true;
return;
}
if(llhelp){
console.log('开始收集您的互助码,用于好友删除与加好友操作');
console.log('\n【开始收集您的互助码,用于好友删除与加好友操作】\n');
for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) {
cookie = cookiesArr[i];
@ -61,10 +77,32 @@ let llhelp=true;
subTitle = '';
option = {};
$.retry = 0;
llgetshare = false;
await GetCollect();
if(llgetshare){
await $.wait(5000);
lnrun++;
}
if(lnrun == 10){
console.log(`\n【访问接口次数达到10次休息一分钟.....】\n`);
await $.wait(60*1000);
lnrun = 0;
}
}
}
if (boolneedUpdate) {
var str = JSON.stringify(TempShareCache, null, 2);
fs.writeFile(strShare, str, function (err) {
if (err) {
console.log(err);
console.log("\n【缓存文件Fruit_ShareCache.json更新失败!】\n");
} else {
console.log("\n【缓存文件Fruit_ShareCache.json更新成功!】\n");
}
})
}
}
console.log('\n【互助码已经收集完毕现在开始账号内部互助请稍等...】\n');
for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) {
cookie = cookiesArr[i];
@ -86,7 +124,13 @@ let llhelp=true;
subTitle = '';
option = {};
$.retry = 0;
lnrun++;
await jdFruit();
if (lnrun == 5) {
console.log(`\n【访问接口次数达到5次休息一分钟.....】\n`);
await $.wait(60 * 1000);
lnrun = 0;
}
}
}
if ($.isNode() && allMessage && $.ctrTemp) {
@ -165,13 +209,39 @@ async function receiveFriendInvite() {
}
async function GetCollect() {
try {
console.log(`\n【京东账号${$.index}${$.UserName})的${$.name}好友互助码】`);
var llfound = false;
var strShareCode = "";
if (TempShareCache) {
for (let j = 0; j < TempShareCache.length; j++) {
if (TempShareCache[j].pt_pin == $.UserName) {
llfound = true;
strShareCode = TempShareCache[j].ShareCode;
}
}
}
if (!llfound) {
console.log($.UserName + "该账号无缓存,尝试联网获取互助码.....");
llgetshare=true;
await initForFarm();
if ($.farmInfo.farmUserPro) {
console.log(`\n【京东账号${$.index}${$.UserName})的${$.name}互助码】${$.farmInfo.farmUserPro.shareCode}`);
newShareCodes.push($.farmInfo.farmUserPro.shareCode)
var tempAddCK = {};
strShareCode=$.farmInfo.farmUserPro.shareCode;
tempAddCK = {
"pt_pin": $.UserName,
"ShareCode": strShareCode
};
TempShareCache.push(tempAddCK);
//标识,需要更新缓存文件
boolneedUpdate = true;
}
}
if (strShareCode) {
console.log(`\n`+strShareCode);
newShareCodes.push(strShareCode)
} else {
console.log(`\n【京东账号${$.index}${$.UserName})的${$.name}互助码】\n数据异常,使用City的互助码:4921b9fe76a340f695f9621b53f35cf5`);
newShareCodes.push("4921b9fe76a340f695f9621b53f35cf5");
console.log(`\n数据异常`);
}
} catch (e) {
$.logErr(e);
@ -564,7 +634,7 @@ function TotalBean() {
})
})
}
function request(function_id, body = {}, timeout = 1000) {
function request(function_id, body = {}, timeout = 2000) {
return new Promise(resolve => {
setTimeout(() => {
$.get(taskUrl(function_id, body), (err, resp, data) => {

854
jd_fruit_help.js Normal file

File diff suppressed because one or more lines are too long

1507
jd_fruit_task.js Normal file

File diff suppressed because it is too large Load Diff