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

Method sign

wxapp/jingjianx_all.js:581–606  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

579 }
580
581 async sign() {
582 try {
583 const reward = await this.getReward();
584 if (!reward.isEnabled) return "未开启签到";
585
586 const progress = await this.getProgress(reward.signCycle);
587 const state = this.getSignedState(reward, progress);
588 $.log(`${this.prefix()} 签到状态: signType=${state.signType} signMode=${state.signMode} currentDay=${state.currentDay} signed=${state.signed}`);
589
590 if (state.signed) return "今日已签到";
591
592 const result = await this.ctx.request({
593 method: "POST",
594 apiPath: state.apiPath,
595 shopId: this.shop.shopId,
596 token: this.token,
597 data: { longitude: 0, latitude: 0 },
598 bizCode: createGuid(),
599 });
600 if (!result.success) throw new Error(result.msg || JSON.stringify(result));
601 const data = result.data || {};
602 return `签到成功${data.rewardName || data.prizeName ? ` 奖励=${data.rewardName || data.prizeName}` : ""}`;
603 } catch (e) {
604 return `签到失败: ${e.message || e}`;
605 }
606 }
607}
608
609!(async () => {

Callers 1

runMethod · 0.95

Calls 7

getRewardMethod · 0.95
getProgressMethod · 0.95
getSignedStateMethod · 0.95
prefixMethod · 0.95
createGuidFunction · 0.85
logMethod · 0.45
requestMethod · 0.45

Tested by

no test coverage detected