|
|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
from django.http import JsonResponse |
|
|
|
|
from django.db.models import Q |
|
|
|
|
from django.views.decorators.csrf import csrf_exempt |
|
|
|
|
import json |
|
|
|
|
from ai.models import * |
|
|
|
|
from ai.utils.show_process import show_main_process |
|
|
|
|
from ai.utils.show_func import get_cinema_show_result_func |
|
|
|
|
@ -50,6 +51,7 @@ def clear_lock(request): |
|
|
|
|
def report(request): |
|
|
|
|
zz_code = request.GET.dict().get('cinema_code') |
|
|
|
|
show_date = request.GET.dict().get('show_date') |
|
|
|
|
force = request.GET.dict().get('force') |
|
|
|
|
print(zz_code, show_date) |
|
|
|
|
cinema = TestCinema.objects.filter(zz_code=zz_code).first() |
|
|
|
|
# 获取真实排片和销售数据 |
|
|
|
|
@ -59,7 +61,7 @@ def report(request): |
|
|
|
|
Q(zz_code=zz_code) & |
|
|
|
|
Q(show_date=show_date) & |
|
|
|
|
Q(updated_at__gt=check_point)).order_by('-id').first() |
|
|
|
|
if not last_real_data: |
|
|
|
|
if (not last_real_data) or (force == '1'): |
|
|
|
|
get_cinema_show_result_func(zz_code, show_date) |
|
|
|
|
|
|
|
|
|
last_ai_data = AiShow.objects.filter(Q(is_ai_show=True) & |
|
|
|
|
@ -176,7 +178,7 @@ def report(request): |
|
|
|
|
'real_sales': last_real_data.sales, |
|
|
|
|
'ai_sales': last_ai_data.sales, |
|
|
|
|
'take_times': last_ai_data.take_times, |
|
|
|
|
'take_tokens': last_ai_data.take_tokens, |
|
|
|
|
'take_tokens': json.loads(last_ai_data.take_tokens)['total_tokens'], |
|
|
|
|
'csv': list_to_csv(output_csv), |
|
|
|
|
'objects': output_list, |
|
|
|
|
'prompt': last_ai_data.prompt |
|
|
|
|
|