|
|
|
@ -3,7 +3,7 @@ from django.db.models import Q |
|
|
|
from django.views.decorators.csrf import csrf_exempt |
|
|
|
from django.views.decorators.csrf import csrf_exempt |
|
|
|
import json |
|
|
|
import json |
|
|
|
from ai.models import * |
|
|
|
from ai.models import * |
|
|
|
from ai.utils.show_process import show_main_process |
|
|
|
from ai.utils.show_process import show_main_process, show_manual_process |
|
|
|
from ai.utils.show_func import * |
|
|
|
from ai.utils.show_func import * |
|
|
|
from ai.utils.basic_func import * |
|
|
|
from ai.utils.basic_func import * |
|
|
|
|
|
|
|
|
|
|
|
@ -53,8 +53,9 @@ def report(request): |
|
|
|
zz_code = request.GET.dict().get('cinema_code') |
|
|
|
zz_code = request.GET.dict().get('cinema_code') |
|
|
|
show_date = request.GET.dict().get('show_date') |
|
|
|
show_date = request.GET.dict().get('show_date') |
|
|
|
force = request.GET.dict().get('force') |
|
|
|
force = request.GET.dict().get('force') |
|
|
|
print(zz_code, show_date) |
|
|
|
test = request.GET.dict().get('test', None) |
|
|
|
cinema = TestCinema.objects.filter(zz_code=zz_code).first() |
|
|
|
print('report-request_params', zz_code, show_date, force, test) |
|
|
|
|
|
|
|
# cinema = TestCinema.objects.filter(zz_code=zz_code).first() |
|
|
|
# 获取真实排片和销售数据 |
|
|
|
# 获取真实排片和销售数据 |
|
|
|
check_point = datetime.datetime.strftime( |
|
|
|
check_point = datetime.datetime.strftime( |
|
|
|
datetime.datetime.strptime(show_date, '%Y-%m-%d') + datetime.timedelta(hours=30), '%Y-%m-%d %H:%M:%S') |
|
|
|
datetime.datetime.strptime(show_date, '%Y-%m-%d') + datetime.timedelta(hours=30), '%Y-%m-%d %H:%M:%S') |
|
|
|
@ -65,9 +66,18 @@ def report(request): |
|
|
|
if (not last_real_data) or (force == '1'): |
|
|
|
if (not last_real_data) or (force == '1'): |
|
|
|
get_cinema_show_result_func(zz_code, show_date) |
|
|
|
get_cinema_show_result_func(zz_code, show_date) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if test is None: |
|
|
|
last_ai_data = AiShow.objects.filter(Q(is_ai_show=True) & |
|
|
|
last_ai_data = AiShow.objects.filter(Q(is_ai_show=True) & |
|
|
|
|
|
|
|
Q(is_manual_test=False) & |
|
|
|
Q(zz_code=zz_code) & |
|
|
|
Q(zz_code=zz_code) & |
|
|
|
Q(show_date=show_date)).order_by('-id').first() |
|
|
|
Q(show_date=show_date)).order_by('-id').first() |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
last_ai_data = AiShow.objects.filter(Q(is_ai_show=True) & |
|
|
|
|
|
|
|
Q(is_manual_test=True) & |
|
|
|
|
|
|
|
Q(zz_code=zz_code) & |
|
|
|
|
|
|
|
Q(show_date=show_date) & |
|
|
|
|
|
|
|
Q(prompt_version=test)).order_by('-id').first() |
|
|
|
|
|
|
|
print('last_ai_data.pk',last_ai_data.pk) |
|
|
|
if not last_ai_data: |
|
|
|
if not last_ai_data: |
|
|
|
result_dict = { |
|
|
|
result_dict = { |
|
|
|
'status': 'Failure', |
|
|
|
'status': 'Failure', |
|
|
|
@ -164,3 +174,35 @@ def insert_new_movie(request): |
|
|
|
} |
|
|
|
} |
|
|
|
print(result_dict) |
|
|
|
print(result_dict) |
|
|
|
return JsonResponse(result_dict, json_dumps_params={'ensure_ascii': False}) |
|
|
|
return JsonResponse(result_dict, json_dumps_params={'ensure_ascii': False}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@csrf_exempt |
|
|
|
|
|
|
|
def manual_test(request): |
|
|
|
|
|
|
|
print(request) |
|
|
|
|
|
|
|
cinema_code = request.POST.get('cinema_code') |
|
|
|
|
|
|
|
show_date = request.POST.get('show_date') |
|
|
|
|
|
|
|
prompt = request.POST.get('prompt') |
|
|
|
|
|
|
|
print(cinema_code, show_date, prompt) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = show_manual_process(cinema_code, show_date, prompt) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result_dict = { |
|
|
|
|
|
|
|
'status': 'success', |
|
|
|
|
|
|
|
'message': '成功', |
|
|
|
|
|
|
|
'data': result |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
print(result_dict) |
|
|
|
|
|
|
|
return JsonResponse(result_dict, json_dumps_params={'ensure_ascii': False}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@csrf_exempt |
|
|
|
|
|
|
|
def get_test_date(request): |
|
|
|
|
|
|
|
cinema_code = request.GET.get('cinema_code') |
|
|
|
|
|
|
|
show_date = request.GET.get('show_date') |
|
|
|
|
|
|
|
result_dict = { |
|
|
|
|
|
|
|
'status': 'success', |
|
|
|
|
|
|
|
'message': '成功', |
|
|
|
|
|
|
|
'date': get_test_date_from_db(cinema_code, show_date) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
print(result_dict) |
|
|
|
|
|
|
|
return JsonResponse(result_dict, json_dumps_params={'ensure_ascii': False}) |
|
|
|
|