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

Method loginByWxCode

wxapp/nice.js:212–226  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

210 }
211
212 async loginByWxCode() {
213 try {
214 const code = await this.getLoginCode();
215 const data = await this.request("/v2/user_login", { code }, { skipToken: true });
216 this.applyToken({
217 token: data?.token,
218 memberId: data?.member_id || data?.u,
219 phone: data?.p,
220 });
221 this.saveCachedToken();
222 $.log(`账号[${this.index}] 登录成功: ${this.memberId || "未知"} ${maskPhone(this.phone) || ""}`);
223 } catch (e) {
224 $.log(`账号[${this.index}] 登录失败: ${e.message || e}`);
225 }
226 }
227
228 async checkToken() {
229 try {

Callers 1

runMethod · 0.95

Calls 6

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

Tested by

no test coverage detected