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

Method handleTask

wxapp/ykb_all.js:535–563  ·  view source on GitHub ↗
(task)

Source from the content-addressed store, hash-verified

533 }
534
535 async handleTask(task) {
536 const name = task.TaskName || task.Name || task.TaskID || "未知任务";
537 let detail = await this.getTaskDetail(task);
538 detail.Status = normalizeStatus(detail.Status);
539 this.log(`任务「${name}」状态=${detail.Status || "未知"}`);
540
541 if (detail.Status === "Complete") {
542 if (detail.RewardReceiveStatus === "UnReceive") await this.receiveTask(detail, task);
543 else this.summary.sign = `任务已完成: ${name}`;
544 return;
545 }
546
547 if (!task.TaskID) return;
548 const challenge = await this.request({
549 method: "POST",
550 apiPath: "/hdb/api/v1/ClientTask/ReceiveTask",
551 data: { ID: task.TaskID },
552 });
553 const userTaskId = challenge?.UserTaskId || challenge?.UserTaskID;
554 if (userTaskId) {
555 detail = await this.getTaskDetail({ UserTaskID: userTaskId });
556 detail.Status = normalizeStatus(detail.Status);
557 if (detail.Status === "Complete" && detail.RewardReceiveStatus === "UnReceive") {
558 await this.receiveTask(detail, { ...task, UserTaskID: userTaskId });
559 } else {
560 this.summary.sign = `任务状态=${detail.Status || "未知"}`;
561 }
562 }
563 }
564
565 async tryTaskSign() {
566 try {

Callers 1

tryTaskSignMethod · 0.95

Calls 5

getTaskDetailMethod · 0.95
logMethod · 0.95
receiveTaskMethod · 0.95
requestMethod · 0.95
normalizeStatusFunction · 0.85

Tested by

no test coverage detected