()
| 89 | } |
| 90 | |
| 91 | async run() { |
| 92 | const cached = this.getCachedToken(); |
| 93 | if (cached) { |
| 94 | this.applyToken(cached); |
| 95 | $.log(`账号[${this.index}] 使用缓存token`); |
| 96 | if (!(await this.checkToken())) { |
| 97 | this.removeCachedToken(); |
| 98 | $.log(`账号[${this.index}] 缓存token失效,重新登录`); |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | if (!this.token) { |
| 103 | await this.loginByWxCode(); |
| 104 | if (!this.token) return; |
| 105 | } |
| 106 | |
| 107 | await this.getSignInfo(); |
| 108 | await this.signIn(); |
| 109 | await this.getSignInfo(); |
| 110 | } |
| 111 | |
| 112 | getCachedToken() { |
| 113 | const cache = readTokenCache(); |
no test coverage detected