()
| 84 | } |
| 85 | |
| 86 | async run() { |
| 87 | if (!this.authorization) { |
| 88 | const cached = this.getCachedToken(); |
| 89 | if (cached) { |
| 90 | this.applyToken(cached); |
| 91 | $.log(`账号[${this.index}] 使用缓存token`); |
| 92 | if (!(await this.checkToken())) { |
| 93 | this.removeCachedToken(); |
| 94 | $.log(`账号[${this.index}] 缓存token失效,重新登录`); |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | if (!this.authorization) { |
| 100 | await this.loginByWxCode(); |
| 101 | if (!this.authorization) return; |
| 102 | } |
| 103 | |
| 104 | await this.getUserInfo(); |
| 105 | await this.getPointsInfo(); |
| 106 | await this.getSignList(); |
| 107 | await this.doSign(); |
| 108 | await this.getPointsInfo(); |
| 109 | this.saveCachedToken(); |
| 110 | } |
| 111 | |
| 112 | cacheKey() { |
| 113 | return this.isDirectToken ? `token:${this.authorization.slice(-16)}` : this.account; |
no test coverage detected