()
| 100 | } |
| 101 | |
| 102 | async run() { |
| 103 | const cached = this.getCachedToken(); |
| 104 | if (cached) { |
| 105 | this.applyToken(cached); |
| 106 | $.log(`账号[${this.index}] 使用缓存token: ${shortValue(this.token)}`); |
| 107 | if (!(await this.checkToken())) { |
| 108 | this.removeCachedToken(); |
| 109 | $.log(`账号[${this.index}] 缓存token失效,重新登录`); |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | if (!this.token) { |
| 114 | await this.loginByWxCode(); |
| 115 | if (!this.token) return; |
| 116 | } |
| 117 | |
| 118 | await this.getUserInfo(); |
| 119 | await this.signIn(); |
| 120 | await this.getRecentSignIn(); |
| 121 | await this.getMemberPoints(); |
| 122 | } |
| 123 | |
| 124 | getCachedToken() { |
| 125 | const cache = readTokenCache(); |
no test coverage detected