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