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