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

Method withRelogin

wxapp/junpinhui.js:246–257  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

244 }
245
246 async withRelogin(fn) {
247 await this.ensureLogin();
248 let res = await fn();
249 const msg = `${res?.message || ""}${res?.msg || ""}`;
250 if (!okCode(res) && this.openid && /登录|授权|token|Token|未认证|失效/.test(msg)) {
251 $.log(`账号[${this.index}] token疑似失效,重新登录`);
252 this.removeToken();
253 await this.login();
254 res = await fn();
255 }
256 return res;
257 }
258
259 async gardenGet(urlPath, params = {}) {
260 const res = await this.withRelogin(() =>

Callers 2

gardenGetMethod · 0.95
gardenPostMethod · 0.95

Calls 5

ensureLoginMethod · 0.95
removeTokenMethod · 0.95
loginMethod · 0.95
okCodeFunction · 0.85
logMethod · 0.45

Tested by

no test coverage detected