(task)
| 475 | } |
| 476 | |
| 477 | async doBrowseTask(task) { |
| 478 | const authCode = await this.getMainCode(); |
| 479 | const clientType = task.client_type || "wechat"; |
| 480 | const startBody = { |
| 481 | mp_id: WPS_MPID, |
| 482 | auth_code: authCode, |
| 483 | browse_app_id: task.app_id || MINI_APP_ID, |
| 484 | client_type: clientType, |
| 485 | version: "new", |
| 486 | }; |
| 487 | if (clientType !== "wechat" && task.path) startBody.path = task.path; |
| 488 | const start = await this.request("POST", TASK_START_BROWSE, { data: startBody }); |
| 489 | if (start.result !== "ok" && start.msg !== "任务已完成") { |
| 490 | $.log(`账号[${this.index}] 浏览任务启动失败[${task.title || task.task_id || task.app_id}]: ${start.msg || JSON.stringify(start)}`); |
| 491 | return false; |
| 492 | } |
| 493 | |
| 494 | await $.wait(16000, 17000); |
| 495 | |
| 496 | const finish = await this.request("POST", TASK_FINISH_BROWSE, { |
| 497 | data: { |
| 498 | mp_id: WPS_MPID, |
| 499 | auth_code: await this.getMainCode(), |
| 500 | app_id: clientType === "wechat_web" ? MINI_APP_ID : task.app_id || MINI_APP_ID, |
| 501 | client_type: clientType, |
| 502 | path: clientType === "wechat_web" ? task.path || "" : "", |
| 503 | version: "new", |
| 504 | user_id: Number(this.uid || this.cookies.uid || 0), |
| 505 | }, |
| 506 | }); |
| 507 | if (finish.result === "ok" || finish.msg === "任务已完成") { |
| 508 | $.log(`账号[${this.index}] 浏览任务完成: ${task.title || task.task_id || task.app_id || task.path || ""}`); |
| 509 | return true; |
| 510 | } |
| 511 | $.log(`账号[${this.index}] 浏览任务完成失败[${task.title || task.task_id || task.app_id}]: ${finish.msg || JSON.stringify(finish)}`); |
| 512 | return false; |
| 513 | } |
| 514 | |
| 515 | async browseTasks() { |
| 516 | let outline; |
no test coverage detected