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

Method login

wxapp/ykb_all.js:368–400  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

366 }
367
368 async login() {
369 const loginApis = [
370 "/ykb_huiyuan/api/v3/MembeGameLogin/appletLogin",
371 "/ykbmini/api/v1/HomeAny/appletLogin",
372 ];
373
374 for (const apiPath of loginApis) {
375 try {
376 const code = await this.getLoginCode();
377 const data = await this.request({
378 method: "POST",
379 apiPath,
380 skipToken: true,
381 data: {
382 Code: code,
383 AppId: this.app.appid,
384 WechatVersion: this.app.wechatVersion,
385 MobilePlatform: this.app.mobilePlatform,
386 MallCode: this.mallCode || "",
387 TemplateVersion: this.app.templateVersion,
388 extra: { q: "" },
389 },
390 });
391 this.applyToken(data);
392 if (!this.token) throw new Error(`登录响应无Token: ${JSON.stringify(data)}`);
393 this.saveCachedToken();
394 this.log(`登录成功(${apiPath}): ${this.customerName || ""} openId=${this.openId || ""}`);
395 return;
396 } catch (e) {
397 this.log(`登录接口 ${apiPath} 失败: ${e.message || e}`);
398 }
399 }
400 }
401
402 async getMemberInfo() {
403 try {

Callers 1

runMethod · 0.95

Calls 5

getLoginCodeMethod · 0.95
requestMethod · 0.95
applyTokenMethod · 0.95
saveCachedTokenMethod · 0.95
logMethod · 0.95

Tested by

no test coverage detected