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

Method run

wxapp/campari.js:73–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

71 }
72
73 async run() {
74 const cached = this.getCachedToken();
75 if (cached) {
76 this.session = cached;
77 $.log(`账号[${this.index}] 使用缓存token`);
78 if (!(await this.checkToken())) {
79 $.log(`账号[${this.index}] 缓存token失效,尝试刷新`);
80 if (!(await this.refreshToken())) {
81 this.removeCachedToken();
82 $.log(`账号[${this.index}] 刷新失败,重新登录`);
83 }
84 }
85 }
86
87 if (!this.session.token) {
88 await this.loginByWxCode();
89 if (!this.session.token) return;
90 }
91
92 await this.doSign();
93 this.saveCachedToken();
94 }
95
96 getCachedToken() {
97 const cache = readTokenCache();

Callers 1

campari.jsFile · 0.45

Calls 8

getCachedTokenMethod · 0.95
checkTokenMethod · 0.95
refreshTokenMethod · 0.95
removeCachedTokenMethod · 0.95
loginByWxCodeMethod · 0.95
doSignMethod · 0.95
saveCachedTokenMethod · 0.95
logMethod · 0.45

Tested by

no test coverage detected