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

Method doSign

wxapp/casetify.js:230–263  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

228 }
229
230 async doSign() {
231 try {
232 const before = await this.getSignInfo();
233 const signDays = Array.isArray(before.signDays) ? before.signDays : [];
234 const todayStatus = signDays.find((item) => normalizeDate(item.signDay) === today());
235 const dailyTask = Array.isArray(before.assignDetail)
236 ? before.assignDetail.find((item) => item.assignmentName && item.assignmentName.includes("单日"))
237 : null;
238 if (todayStatus?.signStatus === 1 || dailyTask?.completeStatus === 1) {
239 $.log(`账号[${this.index}] 今日已签到`);
240 return;
241 }
242
243 const sign = await this.request("POST", "estore-campaign/member/sign/do", {}, { allowAnyCode: true });
244 if (sign.resultCode !== "1") {
245 const message = sign.msg || JSON.stringify(sign);
246 if (/已签|重复/.test(message)) {
247 $.log(`账号[${this.index}] 今日已签到`);
248 return;
249 }
250 throw new Error(message);
251 }
252
253 const after = await this.getSignInfo();
254 const task = Array.isArray(after.assignDetail)
255 ? after.assignDetail.find((item) => item.assignmentName && item.assignmentName.includes("单日"))
256 : null;
257 $.log(`账号[${this.index}] 签到成功: +${task?.awardPrice || "未知"}积分`);
258 } catch (e) {
259 const message = e.message || e;
260 $.log(`账号[${this.index}] 签到失败: ${message}`);
261 if (isTokenError(message)) this.removeCachedToken();
262 }
263 }
264}
265
266!(async () => {

Callers 1

runMethod · 0.95

Calls 7

getSignInfoMethod · 0.95
requestMethod · 0.95
removeCachedTokenMethod · 0.95
normalizeDateFunction · 0.70
todayFunction · 0.70
isTokenErrorFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected