From 087f20dc10cb1a9755543039402329e8d7e34a4b Mon Sep 17 00:00:00 2001 From: RogerWork Date: Fri, 22 Dec 2023 18:09:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=AF=E5=8A=A8mock?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...auditsessioncode_zzmockmodel_auditshowid.py | 18 ++++++++++++++++++ mock/views.py | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 mock/migrations/0003_rename_auditsessioncode_zzmockmodel_auditshowid.py diff --git a/mock/migrations/0003_rename_auditsessioncode_zzmockmodel_auditshowid.py b/mock/migrations/0003_rename_auditsessioncode_zzmockmodel_auditshowid.py new file mode 100644 index 0000000..7a13069 --- /dev/null +++ b/mock/migrations/0003_rename_auditsessioncode_zzmockmodel_auditshowid.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.7 on 2023-12-22 10:06 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('mock', '0002_zzmockmodel_auditsessioncode_zzmockmodel_auditstatus'), + ] + + operations = [ + migrations.RenameField( + model_name='zzmockmodel', + old_name='auditSessionCode', + new_name='auditShowId', + ), + ] diff --git a/mock/views.py b/mock/views.py index 1391d3c..4cfb593 100644 --- a/mock/views.py +++ b/mock/views.py @@ -171,16 +171,32 @@ def get_local_ip(): return ip +# { +# 'reportTicket': '', +# 'reportFilmSchedule': '', +# 'uploadScreenSeatInfo': '', +# 'downloadFilmInfo': '', +# 'getCinemaInfo': '', +# 'getScreenInfo': '', +# 'getOvertimeTicketStatus': '', +# 'validError': '', +# 'auditShowId': '', +# 'auditStatus': '' +# } + # 启动mock def enable_mock(request): ip = request.query_params.dict().get('ip') + mock_config = request.query_params.dict().get('mock_config') server_ip = get_local_ip() current_host = db(ip, GET_ZZ_PLATFORM_HOST_SQL)['data'][0]['cinema_common_info_val'] if current_host == 'https://zzcs.yinghezhong.com' or current_host == 'https://dy.yinghezhong.com': db_result = db(ip, UPDATE_ZZ_PLATFORM_HOST_SQL, (f'http://{server_ip}:8000',)) if db_result['result'] > 0: + ZZMockModel.objects.filter(ip=ip).update(**mock_config) return JsonResponse({'status': 'success'}) if current_host == f'http://{server_ip}:8000': + ZZMockModel.objects.filter(ip=ip).update(**mock_config) return JsonResponse({'status': 'success'}) return JsonResponse({'status': 'fail'})