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