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

Method autoBrowseTask

daily/hyjk.js:404–427  ·  view source on GitHub ↗
(item)

Source from the content-addressed store, hash-verified

402 }
403
404 async autoBrowseTask(item) {
405 const taskId = this.normalizeTaskNumber(item?.taskId);
406 const targetSeconds = this.resolveBrowseTargetSeconds(item);
407 const waitPadding = Number(process.env.HYJK_BROWSE_WAIT_PADDING || 1);
408
409 const startRes = await this.userOperation(5, { taskId, seconds: 0 });
410 $.log(`[账号${this.index}] 浏览任务(taskId=${taskId}) 起始上报seconds=0: ${startRes?.msg || startRes?.code}`);
411
412 const waitMs = Math.max(0, Math.floor((targetSeconds + waitPadding) * 1000));
413 if (waitMs > 0) {
414 $.log(`[账号${this.index}] 浏览任务(taskId=${taskId}) 等待${Math.floor(waitMs / 1000)}秒以满足停留时长`);
415 await $.wait(62);
416 }
417
418 const targetRes = await this.userOperation(5, { taskId, seconds: targetSeconds });
419 $.log(`[账号${this.index}] 浏览任务(taskId=${taskId}) 目标上报seconds=${targetSeconds}: ${targetRes?.msg || targetRes?.code}`);
420
421 const secondsCandidates = this.buildBrowseSecondsCandidates(item).filter(s => s !== 0 && s !== targetSeconds);
422 for (const seconds of secondsCandidates) {
423 const opRes = await this.userOperation(5, { taskId, seconds });
424 $.log(`[账号${this.index}] 浏览任务(taskId=${taskId}) 兜底上报seconds=${seconds}: ${opRes?.msg || opRes?.code}`);
425 await $.wait(400);
426 }
427 }
428
429 async autoTasks() {
430 try {

Callers 1

autoTasksMethod · 0.95

Calls 6

normalizeTaskNumberMethod · 0.95
userOperationMethod · 0.95
logMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected