From 672ebee00c954cd41661751a35a08868eb3d239d Mon Sep 17 00:00:00 2001 From: liuweiqing Date: Sat, 7 Sep 2024 17:58:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8F=AA=E6=9C=89=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E4=BC=9A=E7=AB=8B=E5=88=BB=E5=81=9C=E6=AD=A2?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bypasscf_likeUser.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/bypasscf_likeUser.js b/bypasscf_likeUser.js index d7273b15..09346b41 100644 --- a/bypasscf_likeUser.js +++ b/bypasscf_likeUser.js @@ -112,22 +112,23 @@ function delayClick(time) { return browser; }); // 等待当前批次的任务完成 const browsers = await Promise.all(batch); - console.log( - `批次 ${Math.floor(i / maxConcurrentAccounts) + 1} 完成,关闭浏览器...` - ); - - // 关闭所有浏览器实例 - for (const browser of browsers) { - await browser.close(); - } - // 如果还有下一个批次,等待指定的时间 - if (i + maxConcurrentAccounts < totalAccounts) { + // 如果还有下一个批次,等待指定的时间,同时,如果总共只有一个账号,也需要继续运行 + if (i + maxConcurrentAccounts < totalAccounts || i === 0) { console.log(`等待 ${delayBetweenBatches / 1000} 秒`); await new Promise((resolve) => setTimeout(resolve, delayBetweenBatches) ); } + console.log( + `批次 ${ + Math.floor(i / maxConcurrentAccounts) + 1 + } 完成,关闭浏览器...,浏览器对象:${browsers[0]}` + ); + // 关闭所有浏览器实例 + for (const browser of browsers) { + await browser.close(); + } } console.log("所有账号登录操作已完成");