| 389 | } |
| 390 | |
| 391 | async loginByLoginKey() { |
| 392 | if (!this.loginKey) return false; |
| 393 | const res = await request("POST", ACCOUNT_BASE, "/mobile/s/quickLogin", { |
| 394 | serverCode: 9006, |
| 395 | requestSource: 2, |
| 396 | qrCodeFlag: 0, |
| 397 | accCategory: "newminihxaj", |
| 398 | termType: "1", |
| 399 | loginKey: this.loginKey, |
| 400 | sid: `sid-${Date.now()}-${randHex()}`, |
| 401 | }, { signType: "WEB_CN_GW" }); |
| 402 | const data = res.data?.data || {}; |
| 403 | const tokenInfo = data.tokenInfo || {}; |
| 404 | if (res.status === 200 && Number(data.resultCode) === 0 && tokenInfo.token) { |
| 405 | this.customerId = tokenInfo.customerId || this.customerId; |
| 406 | this.accessToken = tokenInfo.token; |
| 407 | this.refreshToken = tokenInfo.refreshToken || this.refreshToken; |
| 408 | this.saveCache({ loginType: "loginKey" }); |
| 409 | $.log(`账号[${this.index}] loginKey 登录成功: ${mask(this.customerId || this.accessToken)}`); |
| 410 | return true; |
| 411 | } |
| 412 | $.log(`账号[${this.index}] loginKey 登录失败: ${short(res.data, 300)}`); |
| 413 | return false; |
| 414 | } |
| 415 | |
| 416 | async fetchLoginKey() { |
| 417 | if (!this.accessToken || this.loginKey) return; |