()
| 95 | } |
| 96 | |
| 97 | async run() { |
| 98 | if (this.isLegacyToken) { |
| 99 | $.log(`账号[${this.index}] 检测到旧版 authorization#uuid 格式,先迁移到缓存`); |
| 100 | this.saveCachedToken(); |
| 101 | } else { |
| 102 | const cached = this.getCachedToken(); |
| 103 | if (cached?.accessToken) { |
| 104 | this.applyToken(cached); |
| 105 | $.log(`账号[${this.index}] 使用缓存token: ${shortToken(this.token)}`); |
| 106 | if (!(await this.checkToken())) { |
| 107 | this.removeCachedToken(); |
| 108 | $.log(`账号[${this.index}] 缓存token失效,重新CODE登录`); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | if (!this.token) { |
| 113 | await this.loginByWxCode(); |
| 114 | if (!this.token) return; |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | await this.getUserInfo(); |
| 119 | if (!this.userFlag) return; |
| 120 | |
| 121 | await this.task_1(); |
| 122 | await this.task_2(); |
| 123 | await this.getSignActivity(); |
| 124 | |
| 125 | if (this.activity_code) { |
| 126 | await this.signIn(); |
| 127 | await this.getLotteryTaskList(); |
| 128 | await this.getLotteryNum(); |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | cacheKey() { |
| 133 | return this.isLegacyToken ? this.accountId : this.raw; |
no test coverage detected