|
@@ -71,10 +71,12 @@ class ServiceDataView(View):
|
|
|
if not all([start_time, end_time, time_unit, store_meal_type]):
|
|
|
return response.json(444, {'error param': 'startTime or endTime or timeUnit or storeMealType'})
|
|
|
try:
|
|
|
- store_meal_type = int(store_meal_type)
|
|
|
+ store_meal_type = store_meal_type.split(',')
|
|
|
order_qs = OrdersSummary.objects.filter(time__gte=start_time, time__lt=end_time, query_type=0,
|
|
|
- service_type=store_meal_type).values('count', 'country', 'total',
|
|
|
- 'device_type', 'store_meal')
|
|
|
+ service_type__in=store_meal_type).values('count', 'country',
|
|
|
+ 'total',
|
|
|
+ 'device_type',
|
|
|
+ 'store_meal')
|
|
|
all_order_qs = OrdersSummary.objects.filter(time__gte=start_time, time__lt=end_time).filter(
|
|
|
Q(query_type=0) | Q(query_type=1)).values('total', 'count')
|
|
|
all_order_count = 0
|
|
@@ -226,10 +228,10 @@ class ServiceDataView(View):
|
|
|
if not all([start_time, end_time, time_unit, store_meal_type]):
|
|
|
return response.json(444, {'error param': 'startTime or endTime or timeUnit or storeMealType'})
|
|
|
try:
|
|
|
- store_meal_type = int(store_meal_type)
|
|
|
+ store_meal_type = store_meal_type.split(',')
|
|
|
order_qs = OrdersSummary.objects.filter(time__gte=start_time, time__lt=end_time, query_type=1,
|
|
|
- service_type=store_meal_type).values('count', 'country',
|
|
|
- 'device_type')
|
|
|
+ service_type__in=store_meal_type).values('count', 'country',
|
|
|
+ 'device_type')
|
|
|
free_order_count = order_qs.aggregate(count=Sum('count'))['count']
|
|
|
free_order_count = free_order_count if free_order_count else 0 # 免费订单数量
|
|
|
all_order_qs = OrdersSummary.objects.filter(time__gte=start_time, time__lt=end_time).filter(
|
|
@@ -335,9 +337,11 @@ class ServiceDataView(View):
|
|
|
if not all([start_time, end_time, time_unit, store_meal_type]):
|
|
|
return response.json(444, {'error param': 'startTime or endTime or timeUnit or storeMealType'})
|
|
|
try:
|
|
|
+ store_meal_type = store_meal_type.split(',')
|
|
|
order_qs = OrdersSummary.objects.filter(time__gte=start_time, time__lt=end_time, query_type=2,
|
|
|
- service_type=store_meal_type).values('count', 'country', 'total',
|
|
|
- 'device_type')
|
|
|
+ service_type__in=store_meal_type).values('count', 'country',
|
|
|
+ 'total',
|
|
|
+ 'device_type')
|
|
|
all_order_qs = OrdersSummary.objects.filter(time__gte=start_time, time__lt=end_time).filter(
|
|
|
Q(query_type=0) | Q(query_type=1)).values('total', 'count')
|
|
|
all_order_count = 0
|
|
@@ -462,9 +466,11 @@ class ServiceDataView(View):
|
|
|
if not all([start_time, end_time, time_unit, store_meal_type]):
|
|
|
return response.json(444, {'error param': 'startTime or endTime or timeUnit or storeMealType'})
|
|
|
try:
|
|
|
+ store_meal_type = store_meal_type.split(',')
|
|
|
order_qs = OrdersSummary.objects.filter(time__gte=start_time, time__lt=end_time, query_type=3,
|
|
|
- service_type=store_meal_type).values('count', 'country', 'total',
|
|
|
- 'device_type')
|
|
|
+ service_type__in=store_meal_type).values('count', 'country',
|
|
|
+ 'total',
|
|
|
+ 'device_type')
|
|
|
repeat_pay_order_count = order_qs.aggregate(count=Sum('count'))['count']
|
|
|
repeat_pay_order_count = repeat_pay_order_count if repeat_pay_order_count else 0
|
|
|
all_order_qs = OrdersSummary.objects.filter(time__gte=start_time, time__lt=end_time).filter(
|