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

Method run

wxapp/mengxiangjia.js:71–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69 }
70
71 async run() {
72 const cached = this.getCachedToken();
73 if (cached?.access_token || cached?.accessToken) {
74 this.loginResult = cached;
75 $.log(`账号[${this.index}] 使用缓存token: ${maskToken(this.accessToken)}`);
76 if (!(await this.checkToken())) {
77 this.removeCachedToken();
78 $.log(`账号[${this.index}] 缓存token失效,重新code登录`);
79 }
80 }
81
82 if (!this.accessToken) {
83 await this.loginByWxCode();
84 if (!this.accessToken) return;
85 }
86
87 await this.getPointsInfo("签到前");
88 await this.getSignConfig();
89 const today = await this.getTodaySignItem();
90 if (today?.daySignStatus === 2) {
91 $.log(`账号[${this.index}] 今日已签到`);
92 } else {
93 await this.signIn(today?.dateStr);
94 }
95 await this.getPointsInfo("签到后");
96 }
97
98 getCachedToken() {
99 const cache = readTokenCache();

Callers 1

mengxiangjia.jsFile · 0.45

Calls 10

getCachedTokenMethod · 0.95
checkTokenMethod · 0.95
removeCachedTokenMethod · 0.95
loginByWxCodeMethod · 0.95
getPointsInfoMethod · 0.95
getSignConfigMethod · 0.95
getTodaySignItemMethod · 0.95
signInMethod · 0.95
maskTokenFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected