()
| 80 | } |
| 81 | |
| 82 | async run() { |
| 83 | const cached = this.getCachedToken(); |
| 84 | if (cached?.token) { |
| 85 | this.token = cached.token; |
| 86 | this.userInfo = cached.userInfo || {}; |
| 87 | $.log(`账号[${this.index}] 使用缓存token: ${shortToken(this.token)}`); |
| 88 | if (!(await this.checkToken())) { |
| 89 | this.removeCachedToken(); |
| 90 | $.log(`账号[${this.index}] 缓存token失效,重新登录`); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | if (!this.token) { |
| 95 | await this.loginByWxCode(); |
| 96 | if (!this.token) return; |
| 97 | } |
| 98 | |
| 99 | await this.getPoints("当前"); |
| 100 | await this.signIn(); |
| 101 | await this.getPoints("签到后"); |
| 102 | } |
| 103 | |
| 104 | get userId() { |
| 105 | return this.userInfo?.userId || this.userInfo?.id || 1; |
no test coverage detected