From b2b7b5f65c1dc08ef75eb0da07ac5a064868a4eb Mon Sep 17 00:00:00 2001 From: RogerWork Date: Fri, 20 Sep 2024 08:58:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9A=8F=E6=9C=BA=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E7=94=9F=E6=88=90=E7=9A=84=E9=80=BB=E8=BE=91=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dspt_api/util/general/random_params.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/dspt_api/util/general/random_params.py b/dspt_api/util/general/random_params.py index 81a95a6..f2b3ad4 100644 --- a/dspt_api/util/general/random_params.py +++ b/dspt_api/util/general/random_params.py @@ -20,23 +20,26 @@ def random_params(_user_info, _handle_data): 'format': _user_info["format"], 'timestamp': int(time.time() * 1000), } + print('random_params_user_info["api"]', _user_info["api"] == 'ecard/ecard-levels') if _user_info["api"] == 'play/seat-status': _user_data = get_ok_status_seat_list(_handle_data['res']['data']) - if _user_info["api"] == 'ecard/ecard-levels': + elif _user_info["api"] == 'ecard/ecard-levels': + print('ecard/ecard-levels') _user_data = _handle_data['res']['data']['ecardLevelData'] - if _user_info["api"] == 'cinema/goods': + elif _user_info["api"] == 'cinema/goods': print('random_params', _handle_data['res']['data']) _user_data = [random_goods(_handle_data['res']['data'])] else: _user_data = _handle_data['res']['data'] - if len(_user_data) > 0: - if _user_info["api"] in ('play/seat-status', 'cinema/goods'): - data['user_data'] = [[random.choice(_user_data)]] + if len(_user_data) > 0: + print('random_params', _user_data) + if _user_info["api"] in ('play/seat-status', 'cinema/goods'): + data['user_data'] = [[random.choice(_user_data)]] + else: + data['user_data'] = [random.choice(_user_data)] + redis_conn.set(redis_key_api, json.dumps(data), 10 * 60 * 60) else: - data['user_data'] = [random.choice(_user_data)] - redis_conn.set(redis_key_api, json.dumps(data), 10 * 60 * 60) - else: - redis_conn.delete(redis_key_api) + redis_conn.delete(redis_key_api) def get_ok_status_seat_list(_data):