()
| 106 | } |
| 107 | |
| 108 | async run() { |
| 109 | if (this.isLegacyToken) { |
| 110 | $.log(`账号[${this.index}] 检测到旧版 token 格式,将仅用于迁移缓存`); |
| 111 | this.saveCachedToken(); |
| 112 | } else { |
| 113 | const cached = this.getCachedToken(); |
| 114 | if (cached?.token) { |
| 115 | this.applyToken(cached); |
| 116 | $.log(`账号[${this.index}] 使用缓存token: ${shortToken(this.token)}`); |
| 117 | if (!(await this.checkToken())) { |
| 118 | this.removeCachedToken(); |
| 119 | $.log(`账号[${this.index}] 缓存token失效,重新尝试CODE登录`); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | if (!this.token) { |
| 124 | await this.loginByWxCode(); |
| 125 | if (!this.token) return; |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | await this.getUserInfo(); |
| 130 | await this.getSignInfo(); |
| 131 | |
| 132 | if (this.signStatus) { |
| 133 | $.log(`账号[${this.index}] 今日已签到`); |
| 134 | return; |
| 135 | } |
| 136 | await this.signInV2(); |
| 137 | } |
| 138 | |
| 139 | cacheKey() { |
| 140 | return this.isLegacyToken ? this.accountId : this.raw; |
nothing calls this directly
no test coverage detected