(phone: str, password: str, account_idx: int = 0, total_accounts: int = 0)
| 436 | |
| 437 | |
| 438 | def process_new_year_lottery(phone: str, password: str, account_idx: int = 0, total_accounts: int = 0): |
| 439 | print(f"\n{'='*50}") |
| 440 | print(f"处理账号: {phone} ({account_idx}/{total_accounts})") |
| 441 | print(f"活动: 2026新年星辰") |
| 442 | print(f"{'='*50}") |
| 443 | |
| 444 | print("\n[1] 账密登录...") |
| 445 | login_result = userLoginNormal(phone, password) |
| 446 | if not login_result: |
| 447 | print("❌ 登录失败") |
| 448 | return False |
| 449 | print("✓ 登录成功") |
| 450 | print("\n[2] 获取ticket...") |
| 451 | ticket = get_ticket(phone, login_result['userId'], login_result['token']) |
| 452 | if not ticket: |
| 453 | print("❌ 获取ticket失败") |
| 454 | return False |
| 455 | print("✓ 获取ticket成功") |
| 456 | print("\n[3] SSO登录...") |
| 457 | token, cookies = sso_login_v2(ticket) |
| 458 | if not token: |
| 459 | print("❌ SSO登录失败") |
| 460 | return False |
| 461 | print(f"✓ SSO登录成功") |
| 462 | |
| 463 | api = InviteAPI(token, cookies) |
| 464 | |
| 465 | print("\n[4] 查询任务状态...") |
| 466 | tasks_result = api.query_person_tasks(phone) |
| 467 | |
| 468 | task1_completed = False |
| 469 | task2_completed = False |
| 470 | |
| 471 | if tasks_result.get("code") == "0000": |
| 472 | tasks = tasks_result.get("data", {}).get("tasks", []) |
| 473 | print(f"✓ 获取到 {len(tasks)} 个任务\n") |
| 474 | |
| 475 | for task in tasks: |
| 476 | task_name = task.get("taskName", "") |
| 477 | task_type = task.get("taskType", "") |
| 478 | task_state = task.get("taskState", 0) # 0=未完成, 1=已完成 |
| 479 | current_progress = task.get("currentProgress", 0) |
| 480 | target_progress = task.get("targetProgress", 0) |
| 481 | lottery_count = task.get("lotteryCount", 0) |
| 482 | |
| 483 | state_text = "✓ 已完成" if task_state == 1 else "○ 未完成" |
| 484 | print(f" {state_text} {task_name} ({current_progress}/{target_progress}) - 奖励: +{lottery_count}次") |
| 485 | |
| 486 | if task_type == "video_make": |
| 487 | task1_completed = (task_state == 1) |
| 488 | elif task_type == "ai_agent_chat": |
| 489 | task2_completed = (task_state == 1) |
| 490 | |
| 491 | print() |
| 492 | else: |
| 493 | print(f"⚠ 查询失败,继续执行任务\n") |
| 494 | |
| 495 | print("[5] 查询初始抽奖次数...") |
no test coverage detected