|
@@ -881,9 +881,14 @@ class CronCollectDataView(View):
|
|
|
if continent_name not in active_user_continent_dict:
|
|
|
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, created_time=created_time,
|
|
|
- continent=active_user_continent_dict)
|
|
|
+ user_qs = DeviceUserSummary.objects.filter(time=start_time, query_type=1)
|
|
|
+ if user_qs.exists():
|
|
|
+ user_qs.update(count=active_user_count, country=active_user_country_dict,
|
|
|
+ continent=active_user_continent_dict)
|
|
|
+ else:
|
|
|
+ DeviceUserSummary.objects.create(time=start_time, query_type=1, count=active_user_count,
|
|
|
+ country=active_user_country_dict, created_time=created_time,
|
|
|
+ continent=active_user_continent_dict)
|
|
|
|
|
|
return response.json(0)
|
|
|
except Exception as e:
|
|
@@ -1492,7 +1497,7 @@ class CronCollectDataView(View):
|
|
|
if item['ucode'] == '':
|
|
|
ucode = '未知ucode'
|
|
|
active_ucode_dict[ucode] = item['count']
|
|
|
- user_qs = DeviceUserSummary.objects.filter(time=start_time)
|
|
|
+ user_qs = DeviceUserSummary.objects.filter(time=start_time, query_type=1)
|
|
|
if user_qs.exists():
|
|
|
user_qs.update(device_type=active_device_type_dict, ucode=active_ucode_dict)
|
|
|
else:
|