()
| 69 | } |
| 70 | |
| 71 | async run() { |
| 72 | const cached = this.getCachedToken(); |
| 73 | if (cached) { |
| 74 | this.session = cached; |
| 75 | $.log(`账号[${this.index}] 使用缓存token`); |
| 76 | if (!(await this.checkToken())) { |
| 77 | this.removeCachedToken(); |
| 78 | $.log(`账号[${this.index}] 缓存token失效,重新登录`); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | if (!this.session.token) { |
| 83 | await this.loginByWxCode(); |
| 84 | if (!this.session.token) return; |
| 85 | } |
| 86 | |
| 87 | await this.doSign(); |
| 88 | this.saveCachedToken(); |
| 89 | } |
| 90 | |
| 91 | getCachedToken() { |
| 92 | const cache = readTokenCache(); |
no test coverage detected