MCPcopy Create free account
hub / github.com/smallfawn/QLScriptPublic / loginByLoginKey

Method loginByLoginKey

wxapp/hisense_aijia.js:391–414  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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;

Callers 1

ensureLoginMethod · 0.95

Calls 6

saveCacheMethod · 0.95
randHexFunction · 0.85
requestFunction · 0.70
maskFunction · 0.70
shortFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected