()
| 114 | } |
| 115 | |
| 116 | async run() { |
| 117 | const cached = this.getCachedToken(); |
| 118 | if (cached) { |
| 119 | this.applyToken(cached); |
| 120 | $.log(`账号[${this.index}] 使用缓存token`); |
| 121 | if (!(await this.checkToken())) { |
| 122 | this.removeCachedToken(); |
| 123 | $.log(`账号[${this.index}] 缓存token失效,重新登录`); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | if (!this.token) { |
| 128 | await this.loginByWxCode(); |
| 129 | if (!this.token) return; |
| 130 | } |
| 131 | |
| 132 | await this.ensureIntegralAccount(); |
| 133 | await this.findSignActivity(); |
| 134 | await this.loadSignInfo(); |
| 135 | await this.doSign(); |
| 136 | this.saveCachedToken(); |
| 137 | } |
| 138 | |
| 139 | getCachedToken() { |
| 140 | const cache = readTokenCache(); |
no test coverage detected