|
@@ -366,6 +366,7 @@ class CronCollectDataView(View):
|
|
|
@staticmethod
|
|
|
def collect_play_back(response):
|
|
|
try:
|
|
|
+ now_time = int(time.time())
|
|
|
today = datetime.datetime.today()
|
|
|
start_time = datetime.datetime(today.year, today.month, today.day)
|
|
|
end_time = start_time + datetime.timedelta(days=1)
|
|
@@ -384,10 +385,12 @@ class CronCollectDataView(View):
|
|
|
vod_hls_summary = vod_hls_summary_qs.first()
|
|
|
vod_hls_summary.play_duration += item['play_duration']
|
|
|
vod_hls_summary.play_frequency += 1
|
|
|
+ vod_hls_summary.updated_time = now_time
|
|
|
vod_hls_summary.save()
|
|
|
else:
|
|
|
- VodHlsSummary.objects.create(uid=item['uid'], time=this_month_stamp,
|
|
|
- play_duration=item['play_duration'], play_frequency=1)
|
|
|
+ VodHlsSummary.objects.create(uid=item['uid'], time=this_month_stamp, created_time=now_time,
|
|
|
+ play_duration=item['play_duration'], play_frequency=1,
|
|
|
+ updated_time=now_time)
|
|
|
|
|
|
return response.json(0)
|
|
|
except Exception as e:
|
|
@@ -396,8 +399,9 @@ class CronCollectDataView(View):
|
|
|
@staticmethod
|
|
|
def collect_device_user(response):
|
|
|
try:
|
|
|
+ created_time = int(time.time())
|
|
|
today = datetime.datetime.today()
|
|
|
- start_time = datetime.datetime(today.year, today.month, today.day)
|
|
|
+ start_time = datetime.datetime(today.year, today.month, 23)
|
|
|
end_time = start_time + datetime.timedelta(days=1)
|
|
|
increase_user_qs = Device_User.objects.filter(data_joined__gte=start_time, data_joined__lt=end_time).values(
|
|
|
'data_joined',
|
|
@@ -427,7 +431,7 @@ class CronCollectDataView(View):
|
|
|
increase_user_continent_dict[continent_name] = 0
|
|
|
increase_user_continent_dict[continent_name] += item['count']
|
|
|
DeviceUserSummary.objects.create(time=start_time, count=increase_user_count,
|
|
|
- country=increase_user_country_dict,
|
|
|
+ country=increase_user_country_dict, created_time=created_time,
|
|
|
continent=increase_user_continent_dict)
|
|
|
if active_user_qs.exists():
|
|
|
active_user_count = active_user_qs.count()
|
|
@@ -444,7 +448,7 @@ class CronCollectDataView(View):
|
|
|
active_user_continent_dict[continent_name] = 0
|
|
|
active_user_continent_dict[continent_name] += item['count']
|
|
|
DeviceUserSummary.objects.create(time=start_time, query_type=1, count=active_user_count,
|
|
|
- country=active_user_country_dict,
|
|
|
+ country=active_user_country_dict, created_time=created_time,
|
|
|
continent=active_user_continent_dict)
|
|
|
|
|
|
return response.json(0)
|
|
@@ -454,6 +458,7 @@ class CronCollectDataView(View):
|
|
|
@staticmethod
|
|
|
def collect_order(response):
|
|
|
try:
|
|
|
+ created_time = int(time.time())
|
|
|
today = datetime.datetime.today()
|
|
|
start_time = datetime.datetime(today.year, today.month, today.day)
|
|
|
end_time = start_time + datetime.timedelta(days=1)
|
|
@@ -577,7 +582,7 @@ class CronCollectDataView(View):
|
|
|
}
|
|
|
OrdersSummary.objects.create(time=add_time_stamp, count=1, query_type=query_type,
|
|
|
service_type=order_type, total=final_total,
|
|
|
- country=country_temp_dict,
|
|
|
+ country=country_temp_dict, created_time=created_time,
|
|
|
device_type=device_type_temp_dict,
|
|
|
store_meal=store_meal_temp_dict)
|
|
|
if order_summary_qs.exists():
|
|
@@ -675,7 +680,7 @@ class CronCollectDataView(View):
|
|
|
}
|
|
|
OrdersSummary.objects.create(time=add_time_stamp, count=1, query_type=is_pay,
|
|
|
service_type=order_type, total=final_total,
|
|
|
- country=country_temp_dict,
|
|
|
+ country=country_temp_dict, created_time=created_time,
|
|
|
device_type=device_type_temp_dict, store_meal=store_meal_temp_dict)
|
|
|
return response.json(0)
|
|
|
except Exception as e:
|
|
@@ -684,6 +689,7 @@ class CronCollectDataView(View):
|
|
|
@staticmethod
|
|
|
def collect_device_info(response):
|
|
|
try:
|
|
|
+ created_time = int(time.time())
|
|
|
today = datetime.datetime.today()
|
|
|
start_time = datetime.datetime(today.year, today.month, today.day)
|
|
|
end_time = start_time + datetime.timedelta(days=1)
|
|
@@ -765,7 +771,7 @@ class CronCollectDataView(View):
|
|
|
type_name = device_type_dict.get(item['device_type'], '未知设备类型')
|
|
|
increase_device_unicom_dict[type_name] = item['count']
|
|
|
DeviceInfoSummary.objects.create(time=start_time, count=increase_device_count,
|
|
|
- query_type=0,
|
|
|
+ query_type=0, created_time=created_time,
|
|
|
country=increase_device_country_dict,
|
|
|
continent=increase_device_continent_dict,
|
|
|
vod_service=increase_device_vod_dict,
|
|
@@ -814,7 +820,7 @@ class CronCollectDataView(View):
|
|
|
type_name = device_type_dict.get(item['device_type'], '未知设备类型')
|
|
|
active_device_unicom_dict[type_name] = item['count']
|
|
|
DeviceInfoSummary.objects.create(time=start_time, count=active_device_count,
|
|
|
- query_type=1,
|
|
|
+ query_type=1, created_time=created_time,
|
|
|
country=active_device_country_dict,
|
|
|
continent=active_device_continent_dict,
|
|
|
vod_service=active_device_vod_dict,
|