MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / doSign

Method doSign

wxapp/tmj.js:315–341  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

313 }
314
315 async doSign() {
316 try {
317 const date = todayInfo();
318 const monthInfo = await this.queryMonthSign();
319 const signedList = Array.isArray(monthInfo?.signDateList) ? monthInfo.signDateList : [];
320 if (signedList.some((item) => normalizeDate(item) === date.today)) {
321 $.log(`账号[${this.index}] 今日已签到`);
322 return;
323 }
324
325 const data = await this.request("/activity/sign/sign", {
326 activityId: this.signActivityId,
327 shopId: this.shopId,
328 signDate: date.today,
329 }, "POST");
330 const integral = data?.integral ?? data?.memberDayIntegral ?? "未知";
331 $.log(`账号[${this.index}] 签到成功: +${integral}积分`);
332 } catch (e) {
333 const message = String(e.message || e);
334 if (/已签|重复|already/i.test(message)) {
335 $.log(`账号[${this.index}] 今日已签到`);
336 return;
337 }
338 $.log(`账号[${this.index}] 签到失败: ${message}`);
339 if (isTokenError(message)) this.removeCachedToken();
340 }
341 }
342}
343
344!(async () => {

Callers 1

runMethod · 0.95

Calls 7

queryMonthSignMethod · 0.95
requestMethod · 0.95
removeCachedTokenMethod · 0.95
todayInfoFunction · 0.85
normalizeDateFunction · 0.70
isTokenErrorFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected