临时代码

main
RogerWork 11 months ago
parent 37b0120b38
commit 966de6abe9
  1. 30
      logs/dingxin.log
  2. 4
      mock/mock_templates/__init__.py
  3. 3
      mock/mock_templates/report_film_schedule_tmp.py
  4. 3
      mock/mock_templates/upload_screen_seat_info_tmp.py
  5. 3
      mock/urls.py
  6. 17
      mock/utils/mock_service.py
  7. 30
      mock/views.py

@ -2737,3 +2737,33 @@ INFO 2023-12-21 15:16:16,941 autoreload 668 Watching for file changes with StatR
INFO 2023-12-21 15:17:03,542 basehttp 212 "POST /report/reportTicket HTTP/1.1" 200 75 INFO 2023-12-21 15:17:03,542 basehttp 212 "POST /report/reportTicket HTTP/1.1" 200 75
INFO 2023-12-21 15:17:09,530 autoreload 266 D:\Code\Work\Python\dingxin_toolbox_drf\mock\views.py changed, reloading. INFO 2023-12-21 15:17:09,530 autoreload 266 D:\Code\Work\Python\dingxin_toolbox_drf\mock\views.py changed, reloading.
INFO 2023-12-21 15:17:10,490 autoreload 668 Watching for file changes with StatReloader INFO 2023-12-21 15:17:10,490 autoreload 668 Watching for file changes with StatReloader
INFO 2023-12-21 16:02:19,014 basehttp 212 "POST /report/reportTicket HTTP/1.1" 200 75
INFO 2023-12-21 16:05:07,439 basehttp 212 "POST /report/reportTicket HTTP/1.1" 200 75
INFO 2023-12-21 16:21:05,331 basehttp 212 "POST /report/reportTicket HTTP/1.1" 200 75
INFO 2023-12-21 16:21:59,100 basehttp 212 "POST /report/reportTicket HTTP/1.1" 200 75
INFO 2023-12-21 16:51:58,054 basehttp 212 "POST /report/reportTicket HTTP/1.1" 200 75
INFO 2023-12-21 16:55:30,019 autoreload 266 D:\Code\Work\Python\dingxin_toolbox_drf\mock\views.py changed, reloading.
INFO 2023-12-21 16:55:31,173 autoreload 668 Watching for file changes with StatReloader
INFO 2023-12-21 17:02:03,632 basehttp 212 "POST /report/reportTicket HTTP/1.1" 200 75
INFO 2023-12-21 17:22:29,687 basehttp 212 "POST /report/reportTicket HTTP/1.1" 200 75
INFO 2023-12-21 17:24:10,133 basehttp 212 "POST /report/reportTicket HTTP/1.1" 200 75
INFO 2023-12-21 17:24:48,411 basehttp 212 "POST /report/reportTicket HTTP/1.1" 200 75
INFO 2023-12-21 17:25:26,945 basehttp 212 "POST /report/reportTicket HTTP/1.1" 200 75
INFO 2023-12-21 17:26:35,456 basehttp 212 "POST /report/reportTicket HTTP/1.1" 200 75
INFO 2023-12-21 17:38:39,443 basehttp 212 "POST /report/reportTicket HTTP/1.1" 200 75
INFO 2023-12-21 17:40:34,006 autoreload 266 D:\Code\Work\Python\dingxin_toolbox_drf\mock\utils\mock_service.py changed, reloading.
INFO 2023-12-21 17:40:34,992 autoreload 668 Watching for file changes with StatReloader
INFO 2023-12-21 17:43:15,582 autoreload 266 D:\Code\Work\Python\dingxin_toolbox_drf\mock\mock_templates\report_film_schedule_tmp.py changed, reloading.
INFO 2023-12-21 17:43:16,614 autoreload 668 Watching for file changes with StatReloader
INFO 2023-12-21 17:46:19,828 autoreload 266 D:\Code\Work\Python\dingxin_toolbox_drf\mock\urls.py changed, reloading.
INFO 2023-12-21 17:46:20,796 autoreload 668 Watching for file changes with StatReloader
INFO 2023-12-21 17:49:13,932 autoreload 266 D:\Code\Work\Python\dingxin_toolbox_drf\mock\mock_templates\__init__.py changed, reloading.
INFO 2023-12-21 17:49:14,906 autoreload 668 Watching for file changes with StatReloader
INFO 2023-12-21 17:51:35,471 autoreload 266 D:\Code\Work\Python\dingxin_toolbox_drf\mock\views.py changed, reloading.
INFO 2023-12-21 17:51:36,396 autoreload 668 Watching for file changes with StatReloader
INFO 2023-12-21 17:51:47,291 autoreload 266 D:\Code\Work\Python\dingxin_toolbox_drf\mock\views.py changed, reloading.
INFO 2023-12-21 17:51:48,413 autoreload 668 Watching for file changes with StatReloader
INFO 2023-12-21 17:52:03,683 autoreload 266 D:\Code\Work\Python\dingxin_toolbox_drf\mock\views.py changed, reloading.
INFO 2023-12-21 17:52:04,709 autoreload 668 Watching for file changes with StatReloader
INFO 2023-12-21 17:53:22,622 autoreload 266 D:\Code\Work\Python\dingxin_toolbox_drf\mock\urls.py changed, reloading.
INFO 2023-12-21 17:53:23,514 autoreload 668 Watching for file changes with StatReloader

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

@ -0,0 +1,3 @@
def get():
mock_data = {'message': '操作成功', 'data': None, 'code': '200', 'status': 'success'}
return mock_data

@ -0,0 +1,3 @@
def get():
mock_data = {'message': '操作成功', 'data': None, 'code': '200', 'status': 'success'}
return mock_data

@ -20,5 +20,8 @@ from mock.views import *
urlpatterns = [ urlpatterns = [
path('report/reportTicket', report_ticket), path('report/reportTicket', report_ticket),
path('report/reportFilmSchedule', report_film_schedule),
path('report/uploadScreenSeatInfo', upload_screen_seat_info),
path('report/downloadFilmInfo', download_film_info),
path('data/getCinemaInfo', get_cinema_info), path('data/getCinemaInfo', get_cinema_info),
] ]

@ -9,17 +9,24 @@ ZZ_URL = 'https://zzcs.yinghezhong.com'
def mock(_ip, _api, *args, **kwargs): def mock(_ip, _api, *args, **kwargs):
print('mock') print('mock')
cinema_obj = Cinema.objects.filter(ip=_ip).first() cinema_obj = Cinema.objects.filter(ip=_ip).first()
if _api == 'getCinemaInfo':
mock_data = get_cinema_info_tmp.get(cinema_obj)
return JsonResponse(mock_data, json_dumps_params={'ensure_ascii': False})
if _api == 'reportTicket': if _api == 'reportTicket':
mock_data = report_ticket_tmp.get() mock_data = report_ticket_tmp.get()
return JsonResponse(mock_data, json_dumps_params={'ensure_ascii': False}) return JsonResponse(mock_data, json_dumps_params={'ensure_ascii': False})
if _api == 'reportFilmSchedule':
mock_data = report_film_schedule_tmp.get()
return JsonResponse(mock_data, json_dumps_params={'ensure_ascii': False})
if _api == 'uploadScreenSeatInfo':
mock_data = upload_screen_seat_info_tmp.get()
return JsonResponse(mock_data, json_dumps_params={'ensure_ascii': False})
if _api == 'getCinemaInfo':
mock_data = get_cinema_info_tmp.get(cinema_obj)
return JsonResponse(mock_data, json_dumps_params={'ensure_ascii': False})
def bypass(_r): def bypass(_r):
print('bypass') print('bypass')
print(_r.method, _r.path) # GET /data/getCinemaInfo print(_r.method, _r.path)
print(_r.GET) # <QueryDict: {'cinemaCode': ['14105121'], 'sign': ['f7ca26e79abd3d2225e348da66463fbf'], 'timeStamp': ['1703119043']}> print(_r.GET)
print(_r.POST) print(_r.POST)
if _r.method == 'GET': if _r.method == 'GET':
req_url = ZZ_URL + _r.path req_url = ZZ_URL + _r.path

@ -15,17 +15,47 @@ def report_ticket(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.reportTicket is True: if mock_service_switch.reportTicket is True:
mock_service.bypass(request)
return mock_service.mock(ip, 'reportTicket') return mock_service.mock(ip, 'reportTicket')
else: else:
return mock_service.bypass(request) return mock_service.bypass(request)
# 2、排片数据上报接口 POST /report/reportFilmSchedule # 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 # 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 # 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 # 2、影院信息下载接口 GET /data/getCinemaInfo
def get_cinema_info(request): def get_cinema_info(request):
ip = request.META.get('REMOTE_ADDR') ip = request.META.get('REMOTE_ADDR')

Loading…
Cancel
Save