|
@@ -53,6 +53,7 @@ from Model.models import (
|
|
|
UID_Bucket,
|
|
|
UIDCompanySerialModel,
|
|
|
VodBucketModel, PaypalWebHookEvent, TimeZoneInfo, CountryLanguageModel, UidSetModel, UidPushModel,
|
|
|
+ ExperienceContextModel,
|
|
|
)
|
|
|
from Object.AliPayObject import AliPayObject
|
|
|
from Object.AWS.AmazonS3Util import AmazonS3Util
|
|
@@ -199,6 +200,8 @@ class testView(View):
|
|
|
return self.duplicate_removal_uid_set(request_dict, response)
|
|
|
elif operation == 'checkSerialUID':
|
|
|
return self.checkSerialUID(response)
|
|
|
+ elif operation == 'statisticalCloudStorageData':
|
|
|
+ return self.statistical_cloud_storage_data()
|
|
|
else:
|
|
|
return response.json(414)
|
|
|
|
|
@@ -1523,3 +1526,50 @@ class testView(View):
|
|
|
except Exception as e:
|
|
|
return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
|
|
|
+ @staticmethod
|
|
|
+ def statistical_cloud_storage_data():
|
|
|
+ """
|
|
|
+ 统计近一年的云存数据
|
|
|
+ @return:
|
|
|
+ """
|
|
|
+ joined_time = '2023-12-2'
|
|
|
+ uid_list = Device_Info.objects.filter(data_joined__gt=joined_time).values_list('UID', flat=True)
|
|
|
+ uid_set_qs = UidSetModel.objects.filter(uid__in=UidSetModel).values('uid', 'ucode', 'device_type')
|
|
|
+ cloud_vod_count, on_experience_count, only_experience_count, pay_count = 0, 0, 0, 0
|
|
|
+ two_mp_count = three_mp_count = four_mp_count = five_mp_count = eight_mp_count = 0, 0, 0, 0, 0
|
|
|
+ for uid_set in uid_set_qs:
|
|
|
+ ucode = uid_set['ucode']
|
|
|
+ cloud_vod = CommonService.is_cloud_device(
|
|
|
+ ucode, uid_set['device_type']
|
|
|
+ )
|
|
|
+ if cloud_vod:
|
|
|
+ uid = uid_set['uid']
|
|
|
+ cloud_vod_count += 1
|
|
|
+ experience_qs = ExperienceContextModel.objects.filter(uid=uid)
|
|
|
+ if experience_qs.exists():
|
|
|
+ # 购买过付费套餐
|
|
|
+ order_qs = Order_Model.objects.filter(UID=uid)
|
|
|
+ if order_qs.exists():
|
|
|
+ pay_count += 1
|
|
|
+ else:
|
|
|
+ only_experience_count += 1
|
|
|
+ # 未体验过云存
|
|
|
+ else:
|
|
|
+ on_experience_count += 1
|
|
|
+ # 查询设备分辨率
|
|
|
+ resolution_identification = ucode[-5]
|
|
|
+ if resolution_identification == '2':
|
|
|
+ two_mp_count += 1
|
|
|
+ elif resolution_identification == '3':
|
|
|
+ three_mp_count += 1
|
|
|
+ elif resolution_identification == '4':
|
|
|
+ four_mp_count += 1
|
|
|
+ elif resolution_identification in ['5', 'A']:
|
|
|
+ five_mp_count += 1
|
|
|
+ elif resolution_identification == '8':
|
|
|
+ eight_mp_count += 1
|
|
|
+ print('支持云存设备数量:{}, 未使用过云存设备数量:{}, 仅体验设备数量:{}, 云存付费设备数量:{}'.
|
|
|
+ format(cloud_vod_count, on_experience_count, only_experience_count, pay_count))
|
|
|
+ print('2MP:{}, 3MP:{}, 4MP:{}, 5MP:{}, 8MP:{}'.
|
|
|
+ format(two_mp_count, three_mp_count, four_mp_count, five_mp_count, eight_mp_count))
|
|
|
+
|