()
| 263 | } |
| 264 | |
| 265 | async ensureLogin() { |
| 266 | const cached = this.getCached(); |
| 267 | this.token = this.token || cached.token || ""; |
| 268 | this.userInfo.userId = cached.userId || ""; |
| 269 | if (this.token) return; |
| 270 | if (!(await this.loginByCode())) { |
| 271 | $.log(`账号[${this.index}] code未返回token,尝试手机号授权数据登录`); |
| 272 | await this.loginByOperateData(); |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | async api(method, urlPath, options = {}) { |
| 277 | let res = await request(method, urlPath, { ...options, token: this.token }); |
no test coverage detected