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

Method ensureLogin

wxapp/yichengtong.js:265–274  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

263 }
264
265 async ensureLogin() {
266 const cached = this.getCached();
267 this.token = this.token || cached.token || "";
268 this.userInfo.userId = cached.userId || "";
269 if (this.token) return;
270 if (!(await this.loginByCode())) {
271 $.log(`账号[${this.index}] code未返回token,尝试手机号授权数据登录`);
272 await this.loginByOperateData();
273 }
274 }
275
276 async api(method, urlPath, options = {}) {
277 let res = await request(method, urlPath, { ...options, token: this.token });

Callers 2

apiMethod · 0.95
runMethod · 0.95

Calls 4

getCachedMethod · 0.95
loginByCodeMethod · 0.95
loginByOperateDataMethod · 0.95
logMethod · 0.45

Tested by

no test coverage detected