From 2b5168f9dac98620d4a938d5a3b7ce5d6aeacb82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8A=E6=9D=89=E4=B9=9D=E6=9C=88?= <70024132+sakurasep@users.noreply.github.com> Date: Fri, 22 Mar 2024 08:34:01 +0800 Subject: [PATCH] Update get_seat.py --- py/main/get_seat.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/py/main/get_seat.py b/py/main/get_seat.py index ddfbb44..aeb56c2 100644 --- a/py/main/get_seat.py +++ b/py/main/get_seat.py @@ -204,7 +204,7 @@ def check_book_seat(): try: res = get_member_seat(AUTH_TOKEN) for entry in res["data"]["data"]: - if entry["statusName"] == "预约成功" and DATE == "tomorrow": + if entry["statusName"] == "预约成功" and DATE == "tomorrow" or DATE == "today": logger.info("存在已经预约的座位") seat_id = entry["name"] name = entry["nameMerge"] @@ -249,7 +249,6 @@ def check_reservation_status(): logger.info("此位置已被预约,重新获取座位") elif status == "取消成功": logger.info("取消成功") - sys.exit() def generate_unique_random(): @@ -385,6 +384,7 @@ def cancel_seat(seat_id): "Authorization": AUTH_TOKEN } SEAT_RESULT = send_post_request_and_save_response(URL_CANCEL_SEAT, post_data, request_headers) + check_reservation_status(); except KeyError: logger.info("数据解析错误") @@ -395,7 +395,7 @@ def rebook_seat_or_checkout(): try: get_auth_token() res = get_member_seat(AUTH_TOKEN) - logger.info(res) + # logger.info(res) if res is not None: # 延长半小时,寻找已预约的座位 if MODE == "5": @@ -410,6 +410,7 @@ def rebook_seat_or_checkout(): segment = get_segment(build_id, NEW_DATE) cancel_seat(ids) post_to_get_seat(space, segment) + break else: logger.error("没有找到已经预约的座位,你可能没有预约座位") MESSAGE += "\n没有找到已经预约的座位,你可能没有预约座位"