Skip to content

Commit 5279e73

Browse files
committed
chore(seaGold): 调整执行顺序
1 parent 44e59df commit 5279e73

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

scripts/seaGold.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,10 @@ class SeaGold {
304304
}
305305

306306
async run() {
307+
const juejin = new JuejinHelper();
308+
await juejin.login(env.COOKIE);
309+
this.gameApi = juejin.seagold();
310+
307311
const loginInfo = await this.gameApi.gameLogin();
308312
if (!loginInfo.isAuth) {
309313
throw Error(`掘友 ${loginInfo.name} 未授权, 请前往掘金授权!`);
@@ -370,6 +374,8 @@ class SeaGold {
370374

371375
runTime = new Date();
372376
}
377+
378+
await juejin.logout();
373379
}
374380

375381
toString() {
@@ -386,11 +392,9 @@ ${this.history.length ? `\n游戏记录\n${gameLives}` : ""}
386392
}
387393

388394
async function run(args) {
389-
const juejin = new JuejinHelper();
390-
await juejin.login(env.COOKIE);
391-
392395
const seaGold = new SeaGold();
393-
seaGold.gameApi = juejin.seagold();
396+
397+
await utils.wait(utils.randomRangeNumber(1000, 5000)); // 初始等待1-5s
394398

395399
await seaGold.run();
396400

0 commit comments

Comments
 (0)