Skip to content

Commit

Permalink
Merge pull request #19 from iDerekLi/workflows
Browse files Browse the repository at this point in the history
chore(seaGold): 调整执行顺序
  • Loading branch information
iDerekLi authored Mar 2, 2022
2 parents 5769fa7 + 5279e73 commit 8d8a370
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/seaGold.js
Original file line number Diff line number Diff line change
Expand Up @@ -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} 未授权, 请前往掘金授权!`);
Expand Down Expand Up @@ -370,6 +374,8 @@ class SeaGold {

runTime = new Date();
}

await juejin.logout();
}

toString() {
Expand All @@ -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();

Expand Down

0 comments on commit 8d8a370

Please sign in to comment.