| 331 | |
| 332 | # 任务 数据 |
| 333 | def complete_task(code, token, tid): # 棉花工厂 |
| 334 | url = "https://sg01.purcotton.com/api/task/complete-manual-task" |
| 335 | headers = create_headers(code, token) |
| 336 | payload = { |
| 337 | "tid": tid, |
| 338 | "relate_id": 0, |
| 339 | } |
| 340 | |
| 341 | try: |
| 342 | response = requests.post(url, headers=headers, json=payload) |
| 343 | response.raise_for_status() # 检查HTTP响应状态码,如果不是200系列,则抛出异常 |
| 344 | |
| 345 | # 解析响应数据 |
| 346 | response_data = response.json() |
| 347 | if response_data.get("code") == 200: |
| 348 | print("奖励领取成功。") |
| 349 | tjlq_mpjl(code, token, tid) |
| 350 | else: |
| 351 | # 如果响应中的code不是200,打印错误信息 |
| 352 | print(f"任务失败:{response_data.get('msg')}") |
| 353 | except requests.exceptions.RequestException as e: |
| 354 | # 如果请求过程中发生异常,打印异常信息 |
| 355 | print(f"请求失败: {e}") |
| 356 | |
| 357 | |
| 358 | def lq_fd(code, token, tid): # 三餐福袋和签到 |