MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / loginByWxCode

Method loginByWxCode

wxapp/fsdlb.js:192–214  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

190 }
191
192 async loginByWxCode() {
193 try {
194 const code = await this.getLoginCode();
195 const data = await this.request({
196 method: "POST",
197 path: "/user/login/wx-jc",
198 auth: false,
199 data: {
200 jsCode: code,
201 clientId: CLIENT_ID,
202 myUnionId: "",
203 appPublishType: APP_PUBLISH_TYPE,
204 },
205 });
206 this.token = pickToken(data);
207 this.userInfo = data?.thirdUsrIf || {};
208 if (!this.token) throw new Error(`登录响应未返回token: ${JSON.stringify(data)}`);
209 this.saveCachedToken();
210 $.log(`账号[${this.index}] 登录成功: ${maskPhone(this.userInfo.phone) || this.userInfo.oid || ""}`);
211 } catch (e) {
212 $.log(`账号[${this.index}] 登录失败: ${e.message || e}`);
213 }
214 }
215
216 async checkToken() {
217 try {

Callers 1

runMethod · 0.95

Calls 6

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

Tested by

no test coverage detected