|
@@ -7,6 +7,7 @@ import time
|
|
|
import uuid
|
|
|
import json
|
|
|
import logging
|
|
|
+from collections import defaultdict
|
|
|
|
|
|
import paypalrestsdk
|
|
|
import requests
|
|
@@ -24,10 +25,12 @@ from Controller.Cron.CronTaskController import CronUpdateDataView
|
|
|
from Controller.UnicomCombo.UnicomComboTaskController import UnicomComboTaskView
|
|
|
from Model.models import VodBucketModel, CDKcontextModel, Store_Meal, Order_Model, \
|
|
|
UID_Bucket, ExperienceContextModel, Lang, CloudLogModel, UidSetModel, Unused_Uid_Meal, \
|
|
|
- Device_Info, DeviceTypeModel, UnicomComboOrderInfo, AiService, CountryModel, \
|
|
|
- Device_User, AbnormalOrder, DailyReconciliation, StsCrdModel, LogModel, \
|
|
|
+ Device_Info, DeviceTypeModel, UnicomComboOrderInfo, AiService, CountryModel, CouponLang, CouponConfigModel, \
|
|
|
+ CouponCombo, CouponModel, Device_User, AbnormalOrder, DailyReconciliation, StsCrdModel, LogModel, \
|
|
|
InAppPurchasePackage, InAppRefund
|
|
|
from Object.AppleInAppPurchaseSubscriptionObject import InAppPurchase
|
|
|
+from Object.Enums.RedisKeyConstant import RedisKeyConstant
|
|
|
+from Object.RedisObject import RedisObject
|
|
|
from Object.ResponseObject import ResponseObject
|
|
|
from Object.TokenObject import TokenObject
|
|
|
from Object.UnicomObject import UnicomObjeect
|
|
@@ -64,6 +67,8 @@ class serveManagement(View):
|
|
|
return self.cloudDataExport(request, response)
|
|
|
elif operation == 'getDeviceOrderList':
|
|
|
return self.getDeviceOrderList(request_dict, response)
|
|
|
+ elif operation == 'todayCloudPackageQueryNum':
|
|
|
+ return self.today_cloud_package_query_num(response)
|
|
|
else:
|
|
|
tko = TokenObject(
|
|
|
request.META.get('HTTP_AUTHORIZATION'),
|
|
@@ -141,6 +146,10 @@ class serveManagement(View):
|
|
|
return self.edit_refund_preference(request_dict, response)
|
|
|
elif operation == 'addRefundOrder':
|
|
|
return self.add_refund_order(request_dict, response)
|
|
|
+
|
|
|
+ # 查询每日云存列表界面访问次数
|
|
|
+ elif operation == 'callTodayCloudPackageQueryNum':
|
|
|
+ return self.call_today_cloud_package_query_num(response)
|
|
|
else:
|
|
|
return response.json(404)
|
|
|
|
|
@@ -2610,6 +2619,61 @@ class serveManagement(View):
|
|
|
created_time=now_time, updated_time=now_time)
|
|
|
return response.json(0)
|
|
|
|
|
|
+ @staticmethod
|
|
|
+ def today_cloud_package_query_num(response):
|
|
|
+ """查询每日云存列表界面访问次数"""
|
|
|
+ try:
|
|
|
+ redis_obj = RedisObject()
|
|
|
+ # 获取所有字段
|
|
|
+ all_data = redis_obj.get_all_hash_data(RedisKeyConstant.TODAY_CLOUD_QUERY_NUMBER.value)
|
|
|
+ return response.json(0, all_data)
|
|
|
+ except Exception as e:
|
|
|
+ return response.json(500, str(e))
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def call_today_cloud_package_query_num(response):
|
|
|
+ """查询全球每日云存列表界面访问次数"""
|
|
|
+ try:
|
|
|
+ all_data = []
|
|
|
+ servers = {
|
|
|
+ "test": "https://test.zositechc.cn/serveManagement/todayCloudPackageQueryNum",
|
|
|
+ "eu": "https://api.zositeche.com/serveManagement/todayCloudPackageQueryNum",
|
|
|
+ "cn": "https://www.zositechc.cn/serveManagement/todayCloudPackageQueryNum",
|
|
|
+ "us": "https://www.dvema.com/serveManagement/todayCloudPackageQueryNum"
|
|
|
+ }
|
|
|
+
|
|
|
+ for region in servers:
|
|
|
+ res = requests.get(servers[region], timeout=10)
|
|
|
+ result = json.loads(res.text)
|
|
|
+ region_data = result['data']
|
|
|
+
|
|
|
+ # 数据格式化
|
|
|
+ for date, value in region_data.items():
|
|
|
+ all_data.append({
|
|
|
+ "date": date,
|
|
|
+ "region": region,
|
|
|
+ "value": int(value)
|
|
|
+ })
|
|
|
+
|
|
|
+ # 计算总和 "all" 部分
|
|
|
+ merged = defaultdict(int)
|
|
|
+
|
|
|
+ for record in all_data:
|
|
|
+ date = record["date"]
|
|
|
+ merged[date] += record["value"] # 累加相同日期的值
|
|
|
+
|
|
|
+ # 将"all"总和添加到all_data
|
|
|
+ for date, value in merged.items():
|
|
|
+ all_data.append({
|
|
|
+ "date": date,
|
|
|
+ "region": "all",
|
|
|
+ "value": value
|
|
|
+ })
|
|
|
+
|
|
|
+ return response.json(0, {"list": all_data})
|
|
|
+
|
|
|
+ except Exception as e:
|
|
|
+ return response.json(500, str(e))
|
|
|
|
|
|
|
|
|
|