()
| 520 | } |
| 521 | |
| 522 | async run() { |
| 523 | const cached = this.getCachedToken(); |
| 524 | if (cached) { |
| 525 | this.applyToken(cached); |
| 526 | $.log(`账号[${this.index}] 使用缓存token: ${shortValue(this.token)}`); |
| 527 | if (!(await this.checkToken())) { |
| 528 | this.removeCachedToken(); |
| 529 | $.log(`账号[${this.index}] 缓存token失效,重新登录`); |
| 530 | } |
| 531 | } |
| 532 | if (!this.token) await this.loginByWxCode(); |
| 533 | if (!this.token) return; |
| 534 | |
| 535 | try { |
| 536 | await this.signIn(); |
| 537 | } catch (e) { |
| 538 | $.log(`账号[${this.index}] 签到失败${e.code ? `(${e.code})` : ""}: ${e.message || e}`); |
| 539 | if (tokenError(e)) this.removeCachedToken(); |
| 540 | } |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | !(async () => { |
no test coverage detected