()
| 98 | } |
| 99 | |
| 100 | async run() { |
| 101 | const cached = this.getCachedToken(); |
| 102 | if (cached) { |
| 103 | this.applyToken(cached); |
| 104 | $.log(`账号[${this.index}] 使用缓存token`); |
| 105 | if (!(await this.checkToken())) { |
| 106 | this.removeCachedToken(); |
| 107 | $.log(`账号[${this.index}] 缓存token失效,重新登录`); |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | if (!this.token) { |
| 112 | await this.loginByWxCode(); |
| 113 | if (!this.token) return; |
| 114 | } |
| 115 | |
| 116 | await this.getUser(); |
| 117 | await this.getSignLog(); |
| 118 | await this.doSign(); |
| 119 | } |
| 120 | |
| 121 | getCachedToken() { |
| 122 | const cache = readTokenCache(); |
no test coverage detected