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

Method login

wxapp/jingjianx_all.js:459–476  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

457 }
458
459 async login() {
460 try {
461 const code = await this.ctx.getCode(this.account);
462 const result = await this.ctx.request({
463 method: "POST",
464 apiPath: "/capp/account/login",
465 shopId: this.shop.shopId,
466 data: { code },
467 });
468 if (!result.success) throw new Error(result.msg || JSON.stringify(result));
469 this.applyLogin(result.data || {});
470 if (!this.token) throw new Error(`登录响应无token: ${JSON.stringify(result)}`);
471 this.saveToken();
472 $.log(`${this.prefix()} 登录成功 token=${shortToken(this.token)}`);
473 } catch (e) {
474 $.log(`${this.prefix()} 登录失败: ${e.message || e}`);
475 }
476 }
477
478 async getAssets() {
479 const assets = { coin: 0, integral: 0, ticket: 0, coupon: 0 };

Callers 1

runMethod · 0.95

Calls 7

applyLoginMethod · 0.95
saveTokenMethod · 0.95
prefixMethod · 0.95
shortTokenFunction · 0.70
getCodeMethod · 0.45
requestMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected