修复返回指定json的bug

main
RogerWork 11 months ago
parent 20f74288d4
commit 8a442be939
  1. 16
      mock/views.py

@ -41,7 +41,7 @@ def report_ticket(request):
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first()
if mock_service_switch.reportTicket is True:
if customer_json := json_data.get('reportTicket'):
return customer_json
return JsonResponse(customer_json, json_dumps_params={'ensure_ascii': False})
return mock_service.mock(ip, 'reportTicket')
else:
return mock_service.bypass(request)
@ -54,7 +54,7 @@ def report_film_schedule(request):
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first()
if mock_service_switch.reportFilmSchedule is True:
if customer_json := json_data.get('reportFilmSchedule'):
return customer_json
return JsonResponse(customer_json, json_dumps_params={'ensure_ascii': False})
return mock_service.mock(ip, 'reportFilmSchedule')
else:
return mock_service.bypass(request)
@ -67,7 +67,7 @@ def upload_screen_seat_info(request):
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first()
if mock_service_switch.uploadScreenSeatInfo is True:
if customer_json := json_data.get('uploadScreenSeatInfo'):
return customer_json
return JsonResponse(customer_json, json_dumps_params={'ensure_ascii': False})
return mock_service.mock(ip, 'uploadScreenSeatInfo')
else:
return mock_service.bypass(request)
@ -80,7 +80,7 @@ def download_film_info(request):
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first()
if mock_service_switch.downloadFilmInfo is True:
if customer_json := json_data.get('downloadFilmInfo'):
return customer_json
return JsonResponse(customer_json, json_dumps_params={'ensure_ascii': False})
return mock_service.mock(ip, 'downloadFilmInfo')
else:
return mock_service.bypass(request)
@ -92,7 +92,7 @@ def get_cinema_info(request):
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first()
if mock_service_switch.getCinemaInfo is True:
if customer_json := json_data.get('getCinemaInfo'):
return customer_json
return JsonResponse(customer_json, json_dumps_params={'ensure_ascii': False})
return mock_service.mock(ip, 'getCinemaInfo')
else:
return mock_service.bypass(request)
@ -104,7 +104,7 @@ def get_screen_info(request):
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first()
if mock_service_switch.getScreenInfo is True:
if customer_json := json_data.get('getScreenInfo'):
return customer_json
return JsonResponse(customer_json, json_dumps_params={'ensure_ascii': False})
return mock_service.mock(ip, 'getScreenInfo')
else:
return mock_service.bypass(request)
@ -118,7 +118,7 @@ def get_overtime_ticket_status(request):
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first()
if mock_service_switch.getOvertimeTicketStatus is True:
if customer_json := json_data.get('getOvertimeTicketStatus'):
return customer_json
return JsonResponse(customer_json, json_dumps_params={'ensure_ascii': False})
return mock_service.mock(ip, 'getOvertimeTicketStatus', request=request)
else:
return mock_service.bypass(request)
@ -131,7 +131,7 @@ def valid_error(request):
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first()
if mock_service_switch.validError is True:
if customer_json := json_data.get('validError'):
return customer_json
return JsonResponse(customer_json, json_dumps_params={'ensure_ascii': False})
return mock_service.mock(ip, 'validError')
else:
return mock_service.bypass(request)

Loading…
Cancel
Save