()
| 96 | } |
| 97 | |
| 98 | async run() { |
| 99 | const cached = this.getCachedToken(); |
| 100 | if (cached) { |
| 101 | this.applyToken(cached); |
| 102 | $.log(`账号[${this.index}] 使用缓存登录态: memberId=${shortValue(this.memberId)}`); |
| 103 | if (!(await this.checkLogin())) { |
| 104 | this.removeCachedToken(); |
| 105 | $.log(`账号[${this.index}] 缓存登录态失效,重新登录`); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | if (!this.memberId) { |
| 110 | await this.loginByWxCode(); |
| 111 | if (!this.memberId) return; |
| 112 | } |
| 113 | |
| 114 | await this.getMemberInfo(); |
| 115 | await this.getContinuousDays(); |
| 116 | await this.signIn(); |
| 117 | await this.getContinuousDays(); |
| 118 | } |
| 119 | |
| 120 | getCachedToken() { |
| 121 | const cache = readTokenCache(); |
no test coverage detected