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

Method doTask

wxapp/ctrip.js:478–497  ·  view source on GitHub ↗
(channelCode, task, label)

Source from the content-addressed store, hash-verified

476 }
477
478 async doTask(channelCode, task, label) {
479 const id = taskId(task);
480 if (!id) return;
481 const status = Number(task.status ?? task.taskStatus ?? 0);
482 const title = taskTitle(task);
483 const base = { channelCode, taskId: id, status, done: 0 };
484 $.log(`账号[${this.index}] ${label} 执行任务: ${title},status=${status}`);
485 const receive = await this.taskModel("todoTask", base);
486 const receivedTaskId = receive?.infoMap?.receivedTaskId || receive?.receivedTaskId || "";
487 if (okBusiness(receive)) {
488 $.log(`账号[${this.index}] ${label} 任务上报成功: ${title} ${receive.message || ""}`);
489 await this.receiveTaskAward(channelCode, task, receivedTaskId);
490 }
491
492 await $.wait(1000, 1800);
493 const done = await this.taskModel("todoTask", { ...base, status: 0, done: 1 });
494 if (okBusiness(done)) {
495 $.log(`账号[${this.index}] ${label} 浏览完成上报成功: ${title} ${done.message || ""}`);
496 }
497 }
498
499 async awardTask(channelCode, task, label) {
500 const id = taskId(task);

Callers 1

runTaskChannelMethod · 0.95

Calls 7

taskModelMethod · 0.95
receiveTaskAwardMethod · 0.95
taskIdFunction · 0.85
taskTitleFunction · 0.85
okBusinessFunction · 0.85
logMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected