|
|
@ -1,4 +1,5 @@ |
|
|
|
import datetime |
|
|
|
import datetime |
|
|
|
|
|
|
|
import json |
|
|
|
|
|
|
|
|
|
|
|
import requests |
|
|
|
import requests |
|
|
|
from django.shortcuts import render |
|
|
|
from django.shortcuts import render |
|
|
@ -33,6 +34,7 @@ api_dict = { |
|
|
|
# 1、票房数据上报接口 POST /report/reportTicket |
|
|
|
# 1、票房数据上报接口 POST /report/reportTicket |
|
|
|
@csrf_exempt |
|
|
|
@csrf_exempt |
|
|
|
def report_ticket(request): |
|
|
|
def report_ticket(request): |
|
|
|
|
|
|
|
print(request.GET) |
|
|
|
ip = request.META.get('REMOTE_ADDR') |
|
|
|
ip = request.META.get('REMOTE_ADDR') |
|
|
|
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: |
|
|
@ -104,6 +106,8 @@ def get_overtime_ticket_status(request): |
|
|
|
ip = request.META.get('REMOTE_ADDR') |
|
|
|
ip = request.META.get('REMOTE_ADDR') |
|
|
|
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: |
|
|
|
|
|
|
|
r = mock_service.mock(ip, 'getOvertimeTicketStatus', request=request) |
|
|
|
|
|
|
|
print('r', r) |
|
|
|
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) |
|
|
@ -183,7 +187,7 @@ def get_response(request): |
|
|
|
_api = request.GET.dict().get('api') |
|
|
|
_api = request.GET.dict().get('api') |
|
|
|
_api = api_dict[_api] |
|
|
|
_api = api_dict[_api] |
|
|
|
if _api == 'getOvertimeTicketStatus': |
|
|
|
if _api == 'getOvertimeTicketStatus': |
|
|
|
req = mock_service.mock(_ip, _api, request=request) |
|
|
|
req = mock_service.mock(_ip, _api, request=request, type='getJson') |
|
|
|
else: |
|
|
|
else: |
|
|
|
req = mock_service.mock(_ip, _api) |
|
|
|
req = mock_service.mock(_ip, _api) |
|
|
|
return req |
|
|
|
return req |
|
|
@ -221,9 +225,14 @@ def set_overtime_config(request): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 启动mock |
|
|
|
# 启动mock |
|
|
|
|
|
|
|
@csrf_exempt |
|
|
|
def enable_mock(request): |
|
|
|
def enable_mock(request): |
|
|
|
ip = request.GET.dict().get('ip') |
|
|
|
ip = request.GET.get('ip') |
|
|
|
mock_config = request.POST.dict().get('mock_config') |
|
|
|
req_mock_config = json.loads(request.body)['mock_config'] |
|
|
|
|
|
|
|
mock_config = dict() |
|
|
|
|
|
|
|
for k, v in req_mock_config.items(): |
|
|
|
|
|
|
|
mock_config[api_dict[k]] = v |
|
|
|
|
|
|
|
print(mock_config) |
|
|
|
server_ip = get_local_ip() |
|
|
|
server_ip = get_local_ip() |
|
|
|
current_host = db(ip, GET_ZZ_PLATFORM_HOST_SQL)['data'][0]['cinema_common_info_val'] |
|
|
|
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': |
|
|
|
if current_host == 'https://zzcs.yinghezhong.com' or current_host == 'https://dy.yinghezhong.com': |
|
|
@ -239,7 +248,7 @@ def enable_mock(request): |
|
|
|
|
|
|
|
|
|
|
|
# 停用mock服务 |
|
|
|
# 停用mock服务 |
|
|
|
def disable_mock(request): |
|
|
|
def disable_mock(request): |
|
|
|
ip = request.query_params.dict().get('ip') |
|
|
|
ip = request.GET.get('ip') |
|
|
|
server_ip = get_local_ip() |
|
|
|
server_ip = get_local_ip() |
|
|
|
current_host = db(ip, GET_ZZ_PLATFORM_HOST_SQL)['data'][0]['cinema_common_info_val'] |
|
|
|
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': |
|
|
|
if current_host == 'https://zzcs.yinghezhong.com' or current_host == 'https://dy.yinghezhong.com': |
|
|
|