File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -304,6 +304,10 @@ class SeaGold {
304
304
}
305
305
306
306
async run ( ) {
307
+ const juejin = new JuejinHelper ( ) ;
308
+ await juejin . login ( env . COOKIE ) ;
309
+ this . gameApi = juejin . seagold ( ) ;
310
+
307
311
const loginInfo = await this . gameApi . gameLogin ( ) ;
308
312
if ( ! loginInfo . isAuth ) {
309
313
throw Error ( `掘友 ${ loginInfo . name } 未授权, 请前往掘金授权!` ) ;
@@ -370,6 +374,8 @@ class SeaGold {
370
374
371
375
runTime = new Date ( ) ;
372
376
}
377
+
378
+ await juejin . logout ( ) ;
373
379
}
374
380
375
381
toString ( ) {
@@ -386,11 +392,9 @@ ${this.history.length ? `\n游戏记录\n${gameLives}` : ""}
386
392
}
387
393
388
394
async function run ( args ) {
389
- const juejin = new JuejinHelper ( ) ;
390
- await juejin . login ( env . COOKIE ) ;
391
-
392
395
const seaGold = new SeaGold ( ) ;
393
- seaGold . gameApi = juejin . seagold ( ) ;
396
+
397
+ await utils . wait ( utils . randomRangeNumber ( 1000 , 5000 ) ) ; // 初始等待1-5s
394
398
395
399
await seaGold . run ( ) ;
396
400
You can’t perform that action at this time.
0 commit comments