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

Method loginByWxCode

wxapp/kangshifu.js:181–204  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

179 }
180
181 async loginByWxCode() {
182 try {
183 const code = await this.getLoginCode();
184 const result = await this.request(FORUM_BASE, "whale-member/api/login/login", {
185 method: "POST",
186 auth: false,
187 data: {
188 code,
189 inviterId: "",
190 inviterType: "",
191 inviterMatchUserId: "",
192 spUrl: "",
193 },
194 });
195 const token = result?.data?.token || "";
196 if (!token) throw new Error(`登录响应未返回token: ${JSON.stringify(result)}`);
197 this.token = token;
198 this.member = result?.data?.member || {};
199 this.saveCachedToken();
200 $.log(`账号[${this.index}] 登录成功: ${this.member.nickname || maskPhone(this.member.phone) || this.member.id || ""}`);
201 } catch (e) {
202 $.log(`账号[${this.index}] 登录失败: ${e.message || e}`);
203 }
204 }
205
206 async checkToken() {
207 try {

Callers 1

runMethod · 0.95

Calls 5

getLoginCodeMethod · 0.95
requestMethod · 0.95
saveCachedTokenMethod · 0.95
maskPhoneFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected