()
| 72 | } |
| 73 | |
| 74 | async run() { |
| 75 | const cached = this.getCachedToken(); |
| 76 | if (cached) { |
| 77 | this.token = cached; |
| 78 | $.log(`账号[${this.index}] 使用缓存token: ${maskToken(this.accessToken)}`); |
| 79 | if (!(await this.checkToken())) { |
| 80 | this.removeCachedToken(); |
| 81 | $.log(`账号[${this.index}] 缓存token失效,重新code登录`); |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | if (!this.accessToken) { |
| 86 | await this.loginByWxCode(); |
| 87 | if (!this.accessToken) return; |
| 88 | } |
| 89 | |
| 90 | await this.getPoints("签到前"); |
| 91 | await this.getCheckinInfo(); |
| 92 | await this.doCheckin(); |
| 93 | await this.getPoints("签到后"); |
| 94 | } |
| 95 | |
| 96 | getCachedToken() { |
| 97 | const cache = readTokenCache(); |
no test coverage detected