|
|
@ -1,3 +1,5 @@ |
|
|
|
|
|
|
|
import datetime |
|
|
|
|
|
|
|
|
|
|
|
import requests |
|
|
|
import requests |
|
|
|
from django.shortcuts import render |
|
|
|
from django.shortcuts import render |
|
|
|
from django.http.response import JsonResponse |
|
|
|
from django.http.response import JsonResponse |
|
|
@ -14,6 +16,18 @@ from mock.cinema_sql import * |
|
|
|
|
|
|
|
|
|
|
|
ZZ_URL = 'https://zzcs.yinghezhong.com' |
|
|
|
ZZ_URL = 'https://zzcs.yinghezhong.com' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 用于将前端的接口名转换成后端的 |
|
|
|
|
|
|
|
api_dict = { |
|
|
|
|
|
|
|
'download_film_info': 'downloadFilmInfo', |
|
|
|
|
|
|
|
'get_cinema_info': 'getCinemaInfo', |
|
|
|
|
|
|
|
'get_screen_info': 'getScreenInfo', |
|
|
|
|
|
|
|
'report_ticket': 'reportTicket', |
|
|
|
|
|
|
|
'report_film_schedule': 'reportFilmSchedule', |
|
|
|
|
|
|
|
'upload_screen_seat_info': 'uploadScreenSeatInfo', |
|
|
|
|
|
|
|
'get_overtime_ticket_status': 'getOvertimeTicketStatus', |
|
|
|
|
|
|
|
'valid_error': 'validError' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 数据上报 |
|
|
|
# 数据上报 |
|
|
|
# 1、票房数据上报接口 POST /report/reportTicket |
|
|
|
# 1、票房数据上报接口 POST /report/reportTicket |
|
|
@ -134,15 +148,16 @@ def db(ip, sql, params=None): |
|
|
|
|
|
|
|
|
|
|
|
# 获取过场信息 |
|
|
|
# 获取过场信息 |
|
|
|
def get_overtime_show(request): |
|
|
|
def get_overtime_show(request): |
|
|
|
ip = request.query_params.dict().get('ip') |
|
|
|
ip = request.GET.dict().get('ip') |
|
|
|
# 获取过场售票 |
|
|
|
# 获取过场售票 |
|
|
|
db_result = db(ip, FROM_SELL_ADD_GET_SHOW_SQL) |
|
|
|
db_result = db(ip, FROM_SELL_ADD_GET_SHOW_SQL) |
|
|
|
sell_show_data = db_result['data'] |
|
|
|
sell_show_data = db_result['data'] |
|
|
|
sell_show_list = [] |
|
|
|
sell_show_list = [] |
|
|
|
for show in sell_show_data: |
|
|
|
for show in sell_show_data: |
|
|
|
|
|
|
|
show_time = datetime.datetime.strftime(show['start_time'], '%Y-%m-%d %H:%M:%S') |
|
|
|
|
|
|
|
hall = show['hall_name'] if show['hall_name'] is not None else '影厅信息缺失' |
|
|
|
sell_show_list.append({'id': show['show_id'], |
|
|
|
sell_show_list.append({'id': show['show_id'], |
|
|
|
'show': show['name'] + ' ' + show['start_time'] + ' ' + show[ |
|
|
|
'show': show['name'] + ' ' + show_time + ' ' + hall |
|
|
|
'hall_name'] if show['hall_name'] is not None else '' |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
# 获取过场退票场次 |
|
|
|
# 获取过场退票场次 |
|
|
|
|
|
|
|
|
|
|
@ -150,17 +165,28 @@ def get_overtime_show(request): |
|
|
|
refund_show_data = db_result['data'] |
|
|
|
refund_show_data = db_result['data'] |
|
|
|
refund_show_list = [] |
|
|
|
refund_show_list = [] |
|
|
|
for show in refund_show_data: |
|
|
|
for show in refund_show_data: |
|
|
|
|
|
|
|
show_time = datetime.datetime.strftime(show['start_time'], '%Y-%m-%d %H:%M:%S') |
|
|
|
|
|
|
|
hall = show['hall_name'] if show['hall_name'] is not None else '影厅信息缺失' |
|
|
|
refund_show_list.append({'id': show['show_id'], |
|
|
|
refund_show_list.append({'id': show['show_id'], |
|
|
|
'show': show['name'] + ' ' + show['start_time'] + ' ' + show[ |
|
|
|
'show': show['name'] + ' ' + show_time + ' ' + hall |
|
|
|
'hall_name'] if show['hall_name'] is not None else '' |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
return JsonResponse({'sell': sell_show_list, 'refund': refund_show_list}, json_dumps_params={'ensure_ascii': False}) |
|
|
|
# 专资接口 # operation 1售票 2退票 # status 0不通过 1通过 2待审核 99待提交 |
|
|
|
|
|
|
|
audit_status = [{'key': '0', 'status': '不通过'}, {'key': '1', 'status': '通过'}, {'key': '2', 'status': '待审核'}, |
|
|
|
|
|
|
|
{'key': '99', 'status': '待提交'}] |
|
|
|
|
|
|
|
return JsonResponse({'sell': sell_show_list, 'refund': refund_show_list, 'status': audit_status}, |
|
|
|
|
|
|
|
json_dumps_params={'ensure_ascii': False}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 获取mock数据的json |
|
|
|
# 获取mock数据的json |
|
|
|
def get_response(request, _api): |
|
|
|
def get_response(request): |
|
|
|
_ip = request.query_params.dict().get('ip') |
|
|
|
_ip = request.GET.dict().get('ip') |
|
|
|
return mock_service.mock(_ip, _api) |
|
|
|
_api = request.GET.dict().get('api') |
|
|
|
|
|
|
|
_api = api_dict[_api] |
|
|
|
|
|
|
|
if _api == 'getOvertimeTicketStatus': |
|
|
|
|
|
|
|
req = mock_service.mock(_ip, _api, request=request) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
req = mock_service.mock(_ip, _api) |
|
|
|
|
|
|
|
return req |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 获取本机 IP 地址: |
|
|
|
# 获取本机 IP 地址: |
|
|
@ -184,10 +210,20 @@ def get_local_ip(): |
|
|
|
# 'auditStatus': '' |
|
|
|
# 'auditStatus': '' |
|
|
|
# } |
|
|
|
# } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 设置超时售退票设置 |
|
|
|
|
|
|
|
def set_overtime_config(request): |
|
|
|
|
|
|
|
ip = request.GET.dict().get('ip') |
|
|
|
|
|
|
|
cinema = ZZMockModel.objects.filter(ip=ip).first() |
|
|
|
|
|
|
|
cinema.auditShowId = request.GET.dict().get('show_id') |
|
|
|
|
|
|
|
cinema.auditStatus = request.GET.dict().get('audit_status') |
|
|
|
|
|
|
|
cinema.save() |
|
|
|
|
|
|
|
return JsonResponse({'success': True}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 启动mock |
|
|
|
# 启动mock |
|
|
|
def enable_mock(request): |
|
|
|
def enable_mock(request): |
|
|
|
ip = request.query_params.dict().get('ip') |
|
|
|
ip = request.GET.dict().get('ip') |
|
|
|
mock_config = request.query_params.dict().get('mock_config') |
|
|
|
mock_config = request.POST.dict().get('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': |
|
|
|