From 35b674d012078f6d61180cf16117d06266259649 Mon Sep 17 00:00:00 2001 From: KingRan Date: Sun, 27 Feb 2022 10:31:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_pet.js | 16 ++++++++++++---- jd_pet_help.js | 5 +++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/jd_pet.js b/jd_pet.js index e079245..f458584 100644 --- a/jd_pet.js +++ b/jd_pet.js @@ -183,7 +183,8 @@ async function feedPetsAgain() { if (foodAmount - 100 >= 10) { for (let i = 0; i < parseInt((foodAmount - 100) / 10); i++) { const feedPetRes = await request('feedPets'); - console.log(`投食feedPetRes`); + await $.wait(5 * 1000); + console.log(`投食feedPetRes`); if (feedPetRes.resultCode == 0 && feedPetRes.code == 0) { console.log('投食成功') } @@ -256,7 +257,13 @@ async function doTask() { } // 投食10次 if (feedReachInit && !feedReachInit.finished) { - await feedReachInitFun(); + lnrun++; + await feedReachInitFun(); + if (lnrun == 5) { + console.log(`\n【访问接口次数达到5次,休息半分钟.....】\n`); + await $.wait(30 * 1000); + lnrun = 0; + } } } // 好友助力信息 @@ -418,10 +425,11 @@ async function feedReachInitFun() { console.log('投食任务开始...'); let finishedTimes = $.taskInfo.feedReachInit.hadFeedAmount / 10; //已经喂养了几次 let needFeedTimes = 10 - finishedTimes; //还需要几次 - let tryTimes = 20; //尝试次数 + let tryTimes = 10; //尝试次数 do { console.log(`还需要投食${needFeedTimes}次`); const response = await request('feedPets'); + await $.wait(5 * 1000); console.log(`本次投食结果: ${JSON.stringify(response)}`); if (response.resultCode == 0 && response.code == 0) { needFeedTimes--; @@ -498,7 +506,7 @@ function TotalBean() { } // 请求 async function request(function_id, body = {}) { - await $.wait(6000); //歇口气儿, 不然会报操作频繁 + await $.wait(10 * 1000); //歇口气儿, 不然会报操作频繁 return new Promise((resolve, reject) => { $.post(taskUrl(function_id, body), (err, resp, data) => { try { diff --git a/jd_pet_help.js b/jd_pet_help.js index 1f8900c..300d8dc 100644 --- a/jd_pet_help.js +++ b/jd_pet_help.js @@ -85,7 +85,7 @@ console.log(`共${cookiesArr.length}个京东账号\n`); taskInfoKey = []; option = {}; await GetShareCode(); - await $.wait(3 * 1000); + await $.wait(4 * 1000); } } console.log('\n互助码收集完毕,开始执行内部助力...\n'); @@ -183,6 +183,7 @@ async function jdPet() { $.taskInfo = $.taskInit.result; if (llhelp){ await slaveHelp(); //助力好友 + await $.wait(30 * 1000); } await showMsg(); @@ -455,7 +456,7 @@ function TotalBean() { } // 请求 async function request(function_id, body = {}) { - await $.wait(3000); //歇口气儿, 不然会报操作频繁 + await $.wait(10000); //歇口气儿, 不然会报操作频繁 return new Promise((resolve, reject) => { $.post(taskUrl(function_id, body), (err, resp, data) => { try {