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

Method get_taskDetail_cloud

daily/chinaUnicom.py:2468–2534  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2466 self.log(f"云盘任务: ❌ [{taskName}] 失败: {res}")
2467
2468 def get_taskDetail_cloud(self):
2469 taskList = self.query_cloud_task_list_cloud()
2470 if taskList:
2471 names = [t.get('taskName', '?') for t in taskList]
2472 self.log(f"云盘任务: 任务列表({len(taskList)}): {', '.join(names)}")
2473 else:
2474 self.log("云盘任务: 任务列表为空")
2475 return
2476 for task in taskList:
2477 time.sleep(0.5)
2478 tName = task.get('taskName', '')
2479 tCode = task.get('taskCode')
2480 finishText = task.get('finishText')
2481 finished = int(task.get('finishCount', 0))
2482 required = int(task.get('needCount', 0))
2483 if finishText == "待领取":
2484 self.log(f"云盘任务: [{tName}] 待领取")
2485 self.doPopUp_cloud(tCode, tName, False)
2486 continue
2487 if finishText in ["已完成", "已领取"] or task.get('finishState', False) == True or (required > 0 and finished >= required):
2488 self.log(f"云盘任务: ✅ [{tName}] 已完成")
2489 continue
2490 self.log(f"云盘任务: 开始执行 [{tName}] 进度: {finished}/{required}")
2491 if "签到" in tName:
2492 self.toFinish_cloud(tCode, tName, False)
2493 self.dosign_cloud(tCode, tName)
2494 elif "与AI通通互动" in tName:
2495 self.toFinish_cloud(tCode, tName, False)
2496 self.do_ai_interaction_cloud(tCode, tName)
2497 elif "微信备份" in tName or "通讯录备份" in tName:
2498 self.log(f"云盘任务: [{tName}] 暂未适配,当前缺少该任务专用协议,先跳过")
2499 elif "当月上传容量满1GB" in tName:
2500 upload_path = self.get_cloud_upload_file_path()
2501 if not upload_path:
2502 continue
2503 start_finished = int(task.get('finishCount', 0) or 0)
2504 upload_times, target_stage = self.get_cloud_upload_times(task, os.path.getsize(upload_path))
2505 if upload_times <= 0:
2506 self.log(f"云盘任务: [{tName}] 当前阶段已完成,跳过上传")
2507 continue
2508 extra_times = max(5, (upload_times + 9) // 10)
2509 max_upload_times = upload_times + extra_times
2510 self.toFinish_cloud(tCode, tName, False)
2511 self.log(f"云盘任务: 开始执行1GB上传任务(本次目标阶段 {target_stage}/{max(int(task.get('needCount', 0) or 0), target_stage)},预计{upload_times}次,最多{max_upload_times}次,达到本阶段即停止)...")
2512 upload_ok = 0
2513 for upload_i in range(max_upload_times):
2514 self.log(f"云盘任务: 第{upload_i + 1}/{max_upload_times}次上传")
2515 if self.doUpload_cloud(tCode, tName, notify=False):
2516 upload_ok += 1
2517 should_check = upload_ok > 0 and ((upload_i + 1) >= upload_times or upload_ok % 5 == 0)
2518 if should_check:
2519 current_task = self.get_cloud_task_by_code_cloud(tCode)
2520 if current_task:
2521 current_finished = int(current_task.get('finishCount', 0) or 0)
2522 current_required = int(current_task.get('needCount', 0) or 0)
2523 self.log(f"云盘任务: [{tName}] 当前阶段进度 {current_finished}/{current_required}")
2524 if current_finished >= target_stage or current_task.get('finishText') in ["已完成", "已领取"]:
2525 reached_text = "已达到本阶段目标" if current_finished < current_required else "已达到本月目标"

Callers 1

ltyp_taskMethod · 0.95

Calls 13

logMethod · 0.95
doPopUp_cloudMethod · 0.95
toFinish_cloudMethod · 0.95
dosign_cloudMethod · 0.95
doUpload_cloudMethod · 0.95
sleepMethod · 0.80

Tested by

no test coverage detected