()
| 78 | } |
| 79 | |
| 80 | async run() { |
| 81 | const cached = this.getCachedToken(); |
| 82 | if (cached) { |
| 83 | this.applyToken(cached); |
| 84 | $.log(`账号[${this.index}] 使用缓存token`); |
| 85 | if (!(await this.checkToken())) { |
| 86 | this.removeCachedToken(); |
| 87 | $.log(`账号[${this.index}] 缓存token失效,重新登录`); |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | if (!this.token) { |
| 92 | await this.loginByWxCode(); |
| 93 | if (!this.token) return; |
| 94 | } |
| 95 | |
| 96 | await this.getCampaignId(); |
| 97 | await this.doSign(); |
| 98 | this.saveCachedToken(); |
| 99 | } |
| 100 | |
| 101 | getCachedToken() { |
| 102 | const cache = readTokenCache(); |
no test coverage detected