(method, urlPath, options = {})
| 274 | } |
| 275 | |
| 276 | async api(method, urlPath, options = {}) { |
| 277 | let res = await request(method, urlPath, { ...options, token: this.token }); |
| 278 | if (res.status === 401 || Number(res.data?.code) === 401) { |
| 279 | $.log(`账号[${this.index}] token失效,尝试重新登录`); |
| 280 | this.removeToken(); |
| 281 | this.token = ""; |
| 282 | await this.ensureLogin(); |
| 283 | res = await request(method, urlPath, { ...options, token: this.token }); |
| 284 | } |
| 285 | return res; |
| 286 | } |
| 287 | |
| 288 | async querySignHome() { |
| 289 | const res = await this.api("get", "/client/user/signHome"); |
no test coverage detected