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

Method loginByWxCode

wxapp/jingyoujia.js:173–189  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

171 }
172
173 async loginByWxCode() {
174 try {
175 const code = await this.getLoginCode();
176 const data = await this.request({
177 method: "POST",
178 apiPath: "/login",
179 notAuth: true,
180 data: { code },
181 });
182 this.token = data?.accessToken || "";
183 if (!this.token) throw new Error(`登录响应未返回 accessToken: ${JSON.stringify(data)}`);
184 this.saveCachedToken();
185 $.log(`账号[${this.index}] 登录成功`);
186 } catch (e) {
187 $.log(`账号[${this.index}] 登录失败: ${e.message || e}`);
188 }
189 }
190
191 async checkToken() {
192 try {

Callers 1

runMethod · 0.95

Calls 4

getLoginCodeMethod · 0.95
requestMethod · 0.95
saveCachedTokenMethod · 0.95
logMethod · 0.45

Tested by

no test coverage detected