|
@@ -3,6 +3,7 @@
|
|
|
import time
|
|
|
|
|
|
from django.views.generic.base import View
|
|
|
+
|
|
|
from Model.models import Lang, AiStoreMeal, AiService, Order_Model, Device_User, CountryModel, UidSetModel
|
|
|
from Object.ResponseObject import ResponseObject
|
|
|
from Object.TokenObject import TokenObject
|
|
@@ -134,7 +135,7 @@ class AiServeView(View):
|
|
|
symbol = request_dict.get('symbol', '')
|
|
|
pay_type = request_dict.get(
|
|
|
'pay_type', '')[
|
|
|
- 1:-1].split(',') # '[1,2]' -> ['1','2']
|
|
|
+ 1:-1].split(',') # '[1,2]' -> ['1','2']
|
|
|
is_discounts = int(request_dict.get('is_discounts', 0))
|
|
|
discount_price = request_dict.get('discount_price', '')
|
|
|
is_show = int(request_dict.get('is_show', 1))
|
|
@@ -195,9 +196,9 @@ class AiServeView(View):
|
|
|
page = int(pageNo)
|
|
|
line = int(pageSize)
|
|
|
try:
|
|
|
- if aiMealID: # 条件查询
|
|
|
+ if aiMealID: # 条件查询
|
|
|
store_meal_lang_qs = AiStoreMeal.objects.filter(id=aiMealID)
|
|
|
- else: # 查询全部
|
|
|
+ else: # 查询全部
|
|
|
store_meal_lang_qs = AiStoreMeal.objects.filter(
|
|
|
lang__isnull=False)
|
|
|
ai_meal_lang_val = store_meal_lang_qs.values(
|
|
@@ -210,7 +211,7 @@ class AiServeView(View):
|
|
|
)
|
|
|
total = len(ai_meal_lang_val)
|
|
|
ai_meal_langs = ai_meal_lang_val[(
|
|
|
- page - 1) * line:page * line]
|
|
|
+ page - 1) * line:page * line]
|
|
|
ai_meal_lang_list = []
|
|
|
for ai_meal_lang in ai_meal_langs:
|
|
|
ai_meal_lang_list.append({
|
|
@@ -256,7 +257,7 @@ class AiServeView(View):
|
|
|
title=title,
|
|
|
content=content,
|
|
|
discount_content=discount_content)
|
|
|
- else: # 添加
|
|
|
+ else: # 添加
|
|
|
lang_obj = Lang.objects.filter(
|
|
|
lang=lang,
|
|
|
title=title,
|
|
@@ -326,8 +327,7 @@ class AiServeView(View):
|
|
|
'detect_group',
|
|
|
'endTime',
|
|
|
'addTime',
|
|
|
- 'updTime',)
|
|
|
-
|
|
|
+ 'updTime', ).order_by('-addTime')
|
|
|
ai_service_qs = ai_service_qs[(page - 1) * line:page * line]
|
|
|
return response.json(
|
|
|
0, {'list': list(ai_service_qs), 'total': count})
|
|
@@ -413,8 +413,6 @@ class AiServeView(View):
|
|
|
dev_user_qs = Device_User.objects.filter(userID=order['userID_id']).values('region_country')
|
|
|
region_country = dev_user_qs.first()['region_country']
|
|
|
country = '未知国家'
|
|
|
- if region_country > 0:
|
|
|
- country = '未知国家'
|
|
|
country_qs = CountryModel.objects.filter(id=region_country).values('country_name')
|
|
|
if country_qs.exists():
|
|
|
country = country_qs.first()['country_name']
|
|
@@ -448,7 +446,7 @@ class AiServeView(View):
|
|
|
Oct = int(time.mktime(time.strptime(year + '-10-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
Nov = int(time.mktime(time.strptime(year + '-11-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
Dec = int(time.mktime(time.strptime(year + '-12-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
- Jan_next = int(time.mktime(time.strptime(str(int(year)+1) + '-1-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
+ Jan_next = int(time.mktime(time.strptime(str(int(year) + 1) + '-1-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
|
|
|
list_data = []
|
|
|
ai_store_meal_qs = AiStoreMeal.objects.filter(lang__lang='cn').values('id', 'lang__title', 'lang__content')
|
|
@@ -456,7 +454,7 @@ class AiServeView(View):
|
|
|
return response.json(173)
|
|
|
try:
|
|
|
for ai_store_meal in ai_store_meal_qs:
|
|
|
- name = ai_store_meal['lang__title']+'-'+ai_store_meal['lang__content']
|
|
|
+ name = ai_store_meal['lang__title'] + '-' + ai_store_meal['lang__content']
|
|
|
order = Order_Model.objects.filter(order_type=1, status=1, ai_rank=ai_store_meal['id'])
|
|
|
if not order.exists():
|
|
|
continue
|
|
@@ -472,7 +470,8 @@ class AiServeView(View):
|
|
|
Oct_count = order.filter(status=1, addTime__range=[Oct, Nov]).count()
|
|
|
Nov_count = order.filter(status=1, addTime__range=[Nov, Dec]).count()
|
|
|
Dec_count = order.filter(status=1, addTime__range=[Dec, Jan_next]).count()
|
|
|
- data = [Jan_count, Feb_count, Mar_count, Apr_count, May_count, Jun_count, Jul_count, Aug_count, Sep_count,
|
|
|
+ data = [Jan_count, Feb_count, Mar_count, Apr_count, May_count, Jun_count, Jul_count, Aug_count,
|
|
|
+ Sep_count,
|
|
|
Oct_count, Nov_count, Dec_count]
|
|
|
|
|
|
cloud_data = {
|