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

Method loginByWxCode

wxapp/mfd.js:228–247  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

226 }
227
228 async loginByWxCode() {
229 try {
230 await this.getIdentityInfo();
231 const code = await this.getLoginCode();
232 const result = await this.request({
233 apiPath: "/tnew/myfoodiepet-member/v1/wechat/applet/authorizeV2",
234 params: { code },
235 });
236 const data = result.data || {};
237 this.openId = data.openId || "";
238 this.unionId = data.unionId || "";
239 this.memberId = String(data.memberId || "");
240 this.phone = data.phone || "";
241 if (!this.memberId) throw new Error(`登录响应未返回 memberId: ${JSON.stringify(result)}`);
242 this.saveCachedToken();
243 $.log(`账号[${this.index}] 登录成功: memberId=${shortValue(this.memberId)} ${maskPhone(this.phone)}`);
244 } catch (e) {
245 $.log(`账号[${this.index}] 登录失败: ${e.message || e}`);
246 }
247 }
248
249 async checkLogin() {
250 try {

Callers 1

runMethod · 0.95

Calls 7

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

Tested by

no test coverage detected