From c108d680737d0403a49eb10606a83466aae07eb7 Mon Sep 17 00:00:00 2001 From: RogerWork Date: Mon, 26 Aug 2024 21:07:40 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E6=8A=8A=E7=89=B9=E6=AE=8A=E5=A4=84=E7=90=86=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BB=8E=E4=B8=A4=E5=A4=84=E5=8F=98=E4=B8=BA?= =?UTF-8?q?=E4=B8=80=E5=A4=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dspt_api/util/api/seat_lock.py | 6 +----- dspt_api/util/random_params.py | 5 ++++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/dspt_api/util/api/seat_lock.py b/dspt_api/util/api/seat_lock.py index 27b8d4a..6d99545 100644 --- a/dspt_api/util/api/seat_lock.py +++ b/dspt_api/util/api/seat_lock.py @@ -20,11 +20,7 @@ class ApiSeatLock: if result_play and result_seat: play_data = random.choice(redis_data_play) seat_data = random.choice(redis_data_seat) - seat_id = '' - if isinstance(seat_data, dict): - seat_id = seat_data['cineSeatId'] - if isinstance(seat_data, list): - seat_id = ','.join([seat['cineSeatId'] for seat in seat_data]) + seat_id = ','.join([seat['cineSeatId'] for seat in seat_data]) return [{'param': 'play_id', 'value': play_data['id'], 'is_checked': True, 'result': True}, {'param': 'play_update_time', 'value': play_data['cineUpdateTime'], 'is_checked': True, 'result': True}, diff --git a/dspt_api/util/random_params.py b/dspt_api/util/random_params.py index 264d2ce..79ceffd 100644 --- a/dspt_api/util/random_params.py +++ b/dspt_api/util/random_params.py @@ -25,7 +25,10 @@ def random_params(_user_info, _handle_data): else: _user_data = _handle_data['res']['data'] if len(_user_data) > 0: - data['user_data'] = [random.choice(_user_data)] + if _user_info["api"] == 'play/seat-status': + data['user_data'] = [[random.choice(_user_data)]] + else: + data['user_data'] = [random.choice(_user_data)] redis_conn.set(redis_key_api, json.dumps(data)) else: redis_conn.delete(redis_key_api)