From 5279e7348f8a4ca2874b2eceedbb49739b59e9d7 Mon Sep 17 00:00:00 2001 From: Derek Date: Wed, 2 Mar 2022 18:54:44 +0800 Subject: [PATCH] =?UTF-8?q?chore(seaGold):=20=E8=B0=83=E6=95=B4=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/seaGold.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/seaGold.js b/scripts/seaGold.js index 34c5c48c..4d581b7a 100644 --- a/scripts/seaGold.js +++ b/scripts/seaGold.js @@ -304,6 +304,10 @@ class SeaGold { } async run() { + const juejin = new JuejinHelper(); + await juejin.login(env.COOKIE); + this.gameApi = juejin.seagold(); + const loginInfo = await this.gameApi.gameLogin(); if (!loginInfo.isAuth) { throw Error(`掘友 ${loginInfo.name} 未授权, 请前往掘金授权!`); @@ -370,6 +374,8 @@ class SeaGold { runTime = new Date(); } + + await juejin.logout(); } toString() { @@ -386,11 +392,9 @@ ${this.history.length ? `\n游戏记录\n${gameLives}` : ""} } async function run(args) { - const juejin = new JuejinHelper(); - await juejin.login(env.COOKIE); - const seaGold = new SeaGold(); - seaGold.gameApi = juejin.seagold(); + + await utils.wait(utils.randomRangeNumber(1000, 5000)); // 初始等待1-5s await seaGold.run();