(phone: str, password: str, account_idx: int = 0, total_accounts: int = 0)
| 776 | |
| 777 | |
| 778 | def process_account(phone: str, password: str, account_idx: int = 0, total_accounts: int = 0): |
| 779 | print(f"\n{'='*50}") |
| 780 | print(f"处理账号: {phone} ({account_idx}/{total_accounts})") |
| 781 | print(f": {INVITATION_CODE[:20]}...") |
| 782 | print(f"{'='*50}") |
| 783 | print("\n[1] 账密登录...") |
| 784 | login_result = userLoginNormal(phone, password) |
| 785 | if not login_result: |
| 786 | print("❌ 登录失败") |
| 787 | return False |
| 788 | print("✓ 登录成功") |
| 789 | |
| 790 | print("\n[2] 获取ticket...") |
| 791 | ticket = get_ticket(phone, login_result['userId'], login_result['token']) |
| 792 | if not ticket: |
| 793 | print("❌ 获取ticket失败") |
| 794 | return False |
| 795 | print("✓ 获取ticket成功") |
| 796 | |
| 797 | print("\n[3] SSO登录...") |
| 798 | token, cookies = sso_login_v2(ticket) |
| 799 | if not token: |
| 800 | print("❌ SSO登录失败") |
| 801 | return False |
| 802 | print(f"✓ SSO登录成功,token: {token[:50]}...") |
| 803 | |
| 804 | api = InviteAPI(token, cookies) |
| 805 | |
| 806 | print("\n获取用户信息...") |
| 807 | user_info = api.get_user_info(phone) |
| 808 | if user_info.get("code") == "0000": |
| 809 | print(f"✓ 用户信息获取成功") |
| 810 | else: |
| 811 | print(f"用户信息: {user_info}") |
| 812 | |
| 813 | # Step 7: 检查用户状态 |
| 814 | print("\n[6] 检查用户状态...") |
| 815 | user_state = api.check_user_state(phone) |
| 816 | print(f"用户状态: {user_state}") |
| 817 | |
| 818 | # Step 8: 查询推荐模板列表 |
| 819 | print("\n[8] 查询推荐模板列表...") |
| 820 | templates = api.query_template_list() |
| 821 | template_list = templates.get("data", {}).get("list", []) |
| 822 | if not template_list: |
| 823 | print("❌ 未获取到模板列表") |
| 824 | return False |
| 825 | print(f"✓ 获取到 {len(template_list)} 个模板") |
| 826 | |
| 827 | # Step 9: 选择第一个模板进行制作 |
| 828 | tpl = template_list[0] |
| 829 | template_id = tpl.get("templateId", "") |
| 830 | template_conf_id = tpl.get("templateConfId", "") |
| 831 | video_name = tpl.get("videoName", "") |
| 832 | user_words = tpl.get("userWords1", "1234") |
| 833 | arrange_id = str(tpl.get("arrangeId", "")) |
| 834 | |
| 835 | # 如果有输入限制,生成符合要求的内容 |
nothing calls this directly
no test coverage detected