You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.7 KiB
82 lines
2.7 KiB
import requests |
|
from django.shortcuts import render |
|
from django.http.response import JsonResponse |
|
from mock.utils import mock_service |
|
from mock.models import ZZMockModel |
|
from django.views.decorators.csrf import csrf_exempt |
|
|
|
ZZ_URL = 'https://zzcs.yinghezhong.com' |
|
|
|
|
|
# 数据上报 |
|
# 1、票房数据上报接口 POST /report/reportTicket |
|
@csrf_exempt |
|
def report_ticket(request): |
|
ip = request.META.get('REMOTE_ADDR') |
|
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first() |
|
if mock_service_switch.reportTicket is True: |
|
mock_service.bypass(request) |
|
return mock_service.mock(ip, 'reportTicket') |
|
else: |
|
return mock_service.bypass(request) |
|
|
|
|
|
# 2、排片数据上报接口 POST /report/reportFilmSchedule |
|
@csrf_exempt |
|
def report_film_schedule(request): |
|
ip = request.META.get('REMOTE_ADDR') |
|
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first() |
|
if mock_service_switch.reportFilmSchedule is True: |
|
mock_service.bypass(request) |
|
return mock_service.mock(ip, 'reportFilmSchedule') |
|
else: |
|
return mock_service.bypass(request) |
|
|
|
|
|
# 3、座位信息上报接口 POST /report/uploadScreenSeatInfo |
|
@csrf_exempt |
|
def upload_screen_seat_info(request): |
|
ip = request.META.get('REMOTE_ADDR') |
|
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first() |
|
if mock_service_switch.uploadScreenSeatInfo is True: |
|
mock_service.bypass(request) |
|
return mock_service.mock(ip, 'uploadScreenSeatInfo') |
|
else: |
|
return mock_service.bypass(request) |
|
|
|
|
|
# 数据下载 |
|
# 1、影片信息下载接口 GET /data/downloadFilmInfo |
|
def download_film_info(request): |
|
ip = request.META.get('REMOTE_ADDR') |
|
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first() |
|
if mock_service_switch.downloadFilmInfo is True: |
|
return mock_service.mock(ip, 'downloadFilmInfo') |
|
else: |
|
return mock_service.bypass(request) |
|
|
|
|
|
# 2、影院信息下载接口 GET /data/getCinemaInfo |
|
def get_cinema_info(request): |
|
ip = request.META.get('REMOTE_ADDR') |
|
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first() |
|
if mock_service_switch.getCinemaInfo is True: |
|
return mock_service.mock(ip, 'getCinemaInfo') |
|
else: |
|
return mock_service.bypass(request) |
|
|
|
|
|
# 3、影厅信息下载接口 GET /data/getScreenInfo |
|
def get_screen_info(request): |
|
ip = request.META.get('REMOTE_ADDR') |
|
mock_service_switch = ZZMockModel.objects.filter(ip=ip).first() |
|
if mock_service_switch.getScreenInfo is True: |
|
return mock_service.mock(ip, 'getScreenInfo') |
|
else: |
|
return mock_service.bypass(request) |
|
|
|
# 超时票务审批 |
|
# 1、超时票务受理情况查询接口 GET /data/getOvertimeTicketStatus |
|
# |
|
# 数据查询 |
|
# 2、数据清洗错误查询接口 POST /query/validError
|
|
|