修复返回指定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() mock_service_switch = ZZMockModel.objects.filter(ip=ip).first()
if mock_service_switch.reportTicket is True: if mock_service_switch.reportTicket is True:
if customer_json := json_data.get('reportTicket'): 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') return mock_service.mock(ip, 'reportTicket')
else: else:
return mock_service.bypass(request) return mock_service.bypass(request)
@ -54,7 +54,7 @@ def report_film_schedule(request):
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first() mock_service_switch = ZZMockModel.objects.filter(ip=ip).first()
if mock_service_switch.reportFilmSchedule is True: if mock_service_switch.reportFilmSchedule is True:
if customer_json := json_data.get('reportFilmSchedule'): 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') return mock_service.mock(ip, 'reportFilmSchedule')
else: else:
return mock_service.bypass(request) return mock_service.bypass(request)
@ -67,7 +67,7 @@ def upload_screen_seat_info(request):
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first() mock_service_switch = ZZMockModel.objects.filter(ip=ip).first()
if mock_service_switch.uploadScreenSeatInfo is True: if mock_service_switch.uploadScreenSeatInfo is True:
if customer_json := json_data.get('uploadScreenSeatInfo'): 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') return mock_service.mock(ip, 'uploadScreenSeatInfo')
else: else:
return mock_service.bypass(request) return mock_service.bypass(request)
@ -80,7 +80,7 @@ def download_film_info(request):
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first() mock_service_switch = ZZMockModel.objects.filter(ip=ip).first()
if mock_service_switch.downloadFilmInfo is True: if mock_service_switch.downloadFilmInfo is True:
if customer_json := json_data.get('downloadFilmInfo'): 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') return mock_service.mock(ip, 'downloadFilmInfo')
else: else:
return mock_service.bypass(request) return mock_service.bypass(request)
@ -92,7 +92,7 @@ def get_cinema_info(request):
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first() mock_service_switch = ZZMockModel.objects.filter(ip=ip).first()
if mock_service_switch.getCinemaInfo is True: if mock_service_switch.getCinemaInfo is True:
if customer_json := json_data.get('getCinemaInfo'): 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') return mock_service.mock(ip, 'getCinemaInfo')
else: else:
return mock_service.bypass(request) return mock_service.bypass(request)
@ -104,7 +104,7 @@ def get_screen_info(request):
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first() mock_service_switch = ZZMockModel.objects.filter(ip=ip).first()
if mock_service_switch.getScreenInfo is True: if mock_service_switch.getScreenInfo is True:
if customer_json := json_data.get('getScreenInfo'): 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') return mock_service.mock(ip, 'getScreenInfo')
else: else:
return mock_service.bypass(request) return mock_service.bypass(request)
@ -118,7 +118,7 @@ def get_overtime_ticket_status(request):
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first() mock_service_switch = ZZMockModel.objects.filter(ip=ip).first()
if mock_service_switch.getOvertimeTicketStatus is True: if mock_service_switch.getOvertimeTicketStatus is True:
if customer_json := json_data.get('getOvertimeTicketStatus'): 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) return mock_service.mock(ip, 'getOvertimeTicketStatus', request=request)
else: else:
return mock_service.bypass(request) return mock_service.bypass(request)
@ -131,7 +131,7 @@ def valid_error(request):
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first() mock_service_switch = ZZMockModel.objects.filter(ip=ip).first()
if mock_service_switch.validError is True: if mock_service_switch.validError is True:
if customer_json := json_data.get('validError'): 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') return mock_service.mock(ip, 'validError')
else: else:
return mock_service.bypass(request) return mock_service.bypass(request)

Loading…
Cancel
Save