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