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

Method loginByWxCode

wxapp/roki.js:219–241  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

217 }
218
219 async loginByWxCode() {
220 try {
221 const code = await this.getLoginCode();
222 const result = await this.request({
223 method: "POST",
224 apiPath: "/user/login",
225 skipToken: true,
226 data: {
227 code,
228 param: {
229 "qr-code": "",
230 },
231 },
232 });
233 const data = result.data || {};
234 this.applyToken(data);
235 if (!this.token) throw new Error(`登录响应未返回 token: ${JSON.stringify(result)}`);
236 this.saveCachedToken();
237 $.log(`账号[${this.index}] 登录成功: token=${shortValue(this.token)}`);
238 } catch (e) {
239 $.log(`账号[${this.index}] 登录失败: ${e.message || e}`);
240 }
241 }
242
243 async checkToken() {
244 try {

Callers 1

runMethod · 0.95

Calls 6

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

Tested by

no test coverage detected