临时代码

main
roger_mac 11 months ago
parent 966de6abe9
commit 28e47abe07
  1. 3
      mock/mock_templates/__init__.py
  2. 45
      mock/mock_templates/get_screen_info_tmp.py
  3. 1
      mock/urls.py
  4. 3
      mock/utils/mock_service.py
  5. 10
      mock/views.py

@ -1,4 +1,5 @@
__all__ = ['get_cinema_info_tmp', __all__ = ['get_cinema_info_tmp',
'report_ticket_tmp', 'report_ticket_tmp',
'report_film_schedule_tmp', 'report_film_schedule_tmp',
'upload_screen_seat_info_tmp'] 'upload_screen_seat_info_tmp',
'get_screen_info_tmp']

@ -0,0 +1,45 @@
import pymysql
from pymysql.cursors import DictCursor
def get(cinema_data):
db_config = {
'host': cinema_data.ip,
'user': cinema_data.db_user,
'password': cinema_data.db_pwd,
'database': 'cine',
'connect_timeout': 5,
}
db_conn = pymysql.Connect(**db_config)
db_cursor = db_conn.cursor(cursor=DictCursor)
# cinema_info
cinema_info_sql_str = 'SELECT * FROM cinema_info;'
db_cursor.execute(cinema_info_sql_str)
cinema_info_data = db_cursor.fetchone()
# cinema_set
cinema_set_sql_str = 'SELECT * FROM cinema_set;'
db_cursor.execute(cinema_set_sql_str)
cinema_set_data = db_cursor.fetchone()
# cinema_hall_info
cinema_hall_info_sql_str = 'SELECT * FROM cinema_hall_info;'
db_cursor.execute(cinema_hall_info_sql_str)
cinema_hall_info_data = db_cursor.fetchall()
hall_num = len(cinema_hall_info_data)
db_conn.close()
mock_data = {'message': '操作成功',
'data': {
'cinemaChainName': cinema_info_data['cinema_chain_name'],
'manager': cinema_info_data['cinema_manager'],
'screens': hall_num,
'managerTel': cinema_info_data['cinema_telephone'],
'cinemaName': cinema_set_data['cinema_platform_name'],
'cinemaCode': cinema_set_data['cinema_num'], # 适配字段
'cinemaLevel': cinema_info_data['cinema_level'],
'businessStatus': '12', # 定义字段
'officialName': cinema_info_data['official_name'],
'fax': cinema_info_data['cinema_fax']
},
'code': '200',
'status': 'success'}
return mock_data

@ -24,4 +24,5 @@ urlpatterns = [
path('report/uploadScreenSeatInfo', upload_screen_seat_info), path('report/uploadScreenSeatInfo', upload_screen_seat_info),
path('report/downloadFilmInfo', download_film_info), path('report/downloadFilmInfo', download_film_info),
path('data/getCinemaInfo', get_cinema_info), path('data/getCinemaInfo', get_cinema_info),
path('data/getScreenInfo', get_screen_info),
] ]

@ -21,6 +21,9 @@ def mock(_ip, _api, *args, **kwargs):
if _api == 'getCinemaInfo': if _api == 'getCinemaInfo':
mock_data = get_cinema_info_tmp.get(cinema_obj) mock_data = get_cinema_info_tmp.get(cinema_obj)
return JsonResponse(mock_data, json_dumps_params={'ensure_ascii': False}) return JsonResponse(mock_data, json_dumps_params={'ensure_ascii': False})
if _api == 'getScreenInfo':
mock_data = get_screen_info_tmp.get(cinema_obj)
return JsonResponse(mock_data, json_dumps_params={'ensure_ascii': False})
def bypass(_r): def bypass(_r):

@ -64,9 +64,17 @@ def get_cinema_info(request):
return mock_service.mock(ip, 'getCinemaInfo') return mock_service.mock(ip, 'getCinemaInfo')
else: else:
return mock_service.bypass(request) return mock_service.bypass(request)
# 3、影厅信息下载接口 GET /data/getScreenInfo
# 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 # 1、超时票务受理情况查询接口 GET /data/getOvertimeTicketStatus
# #

Loading…
Cancel
Save