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

Method doSign

wxapp/qiaqia.js:258–280  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

256 }
257
258 async doSign() {
259 try {
260 const signList = await this.getSignList();
261 const signedToday = Array.isArray(signList) && signList.some((item) => String(item?.signTime || "").slice(0, 10) === today());
262 const config = await this.getSignConfig();
263 if (signedToday) {
264 $.log(`账号[${this.index}] 今日已签到,连续${signList[signList.length - 1]?.signContinuousDay || 0}天`);
265 return;
266 }
267
268 const res = await this.mobilePost("/promotion/sign/sign");
269 const point = res?.data?.point || config?.point || "";
270 $.log(`账号[${this.index}] 签到成功${point ? `,积分+${point}` : ""}`);
271 } catch (e) {
272 const message = e.message || e;
273 if (/已签到|每天只能签到一次|重复|今日已/.test(String(message))) {
274 $.log(`账号[${this.index}] 今日已签到`);
275 return;
276 }
277 $.log(`账号[${this.index}] 签到失败: ${message}`);
278 if (isLoginError(message)) this.removeCachedToken();
279 }
280 }
281}
282
283!(async () => {

Callers 1

runMethod · 0.95

Calls 7

getSignListMethod · 0.95
getSignConfigMethod · 0.95
mobilePostMethod · 0.95
removeCachedTokenMethod · 0.95
isLoginErrorFunction · 0.85
todayFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected