()
| 109 | } |
| 110 | |
| 111 | async run() { |
| 112 | const cached = this.getCachedToken(); |
| 113 | if (cached) { |
| 114 | this.token = cached.token || ""; |
| 115 | $.log(`账号[${this.index}] 使用缓存token: ${maskToken(this.token)}`); |
| 116 | if (!(await this.checkToken())) { |
| 117 | $.log(`账号[${this.index}] 缓存token失效,重新code登录`); |
| 118 | this.removeCachedToken(); |
| 119 | this.token = ""; |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | if (!this.token) { |
| 124 | await this.loginByCode(); |
| 125 | } |
| 126 | if (!this.token) return; |
| 127 | |
| 128 | await this.getIndexInfo(); |
| 129 | await this.signIn(); |
| 130 | } |
| 131 | |
| 132 | getCachedToken() { |
| 133 | const cache = readCache(); |
no test coverage detected