ソースを参照

微信支付报错问题

zhangdongming 2 年 前
コミット
82eef06efd
2 ファイル変更47 行追加2 行削除
  1. 33 2
      Controller/Cron/CronTaskController.py
  2. 14 0
      Service/CommonService.py

+ 33 - 2
Controller/Cron/CronTaskController.py

@@ -17,14 +17,17 @@ from django.db import connection, connections, transaction
 from django.db.models import Q, Sum, Count
 from django.views import View
 
+from Ansjer.config import USED_SERIAL_REDIS_LIST, UNUSED_SERIAL_REDIS_LIST
 from Model.models import Device_User, Device_Info, UidSetModel, UID_Bucket, Unused_Uid_Meal, Order_Model, StsCrdModel, \
     VodHlsModel, ExperienceContextModel, AiService, VodHlsSummary, VideoPlaybackTimeModel, DeviceUserSummary, \
-    CountryModel, DeviceTypeModel, Lang, UnicomCombo, OrdersSummary, DeviceInfoSummary, CompanySerialModel
+    CountryModel, DeviceTypeModel, OrdersSummary, DeviceInfoSummary, CompanySerialModel, \
+    CloudLogModel, UidCloudStorageCount
 from Object.RedisObject import RedisObject
 from Object.ResponseObject import ResponseObject
 from Object.utils import LocalDateTimeUtil
 from Service.CommonService import CommonService
-from Ansjer.config import USED_SERIAL_REDIS_LIST, UNUSED_SERIAL_REDIS_LIST
+
+LOGGER = logging.getLogger('info')
 
 
 class CronDelDataView(View):
@@ -50,9 +53,37 @@ class CronDelDataView(View):
             return self.delCloudLog(response)
         elif operation == 'delTesterDevice':  # 定时删除测试账号下的设备数据
             return self.delTesterDevice(response)
+        elif operation == 'cloud-log':
+            return self.uid_cloud_storage_upload_count(response)
         else:
             return response.json(404)
 
+    @staticmethod
+    def uid_cloud_storage_upload_count(response):
+        try:
+            now_time = int(time.time())
+            local_time = LocalDateTimeUtil.get_before_days_timestamp(now_time)
+            format_str = '%Y-%m-%d'
+            date_str = LocalDateTimeUtil.time_stamp_to_time(local_time, format_str)
+            start_time, end_time = LocalDateTimeUtil.get_start_and_end_time(date_str, format_str)
+            cs_uid_qs = UID_Bucket.objects.filter(addTime__gte=int(1669824000)).values('uid')
+            if not cs_uid_qs.exists():
+                return response.json(0)
+            for item in cs_uid_qs:
+                uid = item['uid']
+                cloud_log_qs = CloudLogModel.objects.filter(uid=uid, operation=r'cloudstorage/storeplaylist',
+                                                            time__gte=start_time, time__lte=end_time)
+                cloud_log_qs = cloud_log_qs.values('uid')[0:1]
+                if not cloud_log_qs.exists():
+                    continue
+                count_data = {'uid': uid, 'count': cloud_log_qs.count(), 'created_time': end_time,
+                              'updated_time': end_time}
+                UidCloudStorageCount.objects.create(**count_data)
+            return response.json(0)
+        except Exception as e:
+            LOGGER.info('异常详情,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
+            return response.json(500)
+
     @staticmethod
     def delAccessLog(response):
         try:

+ 14 - 0
Service/CommonService.py

@@ -737,3 +737,17 @@ GCqvlyw5dfxNA+EtxNE2wCW/LW7ENJlACgcfgPlBZtpLheWoZB/maw4=
         @param e: 列表元素
         """
         return sorted(e, key=lambda item: -item['count'])
+
+    @staticmethod
+    def Package_Type(order_type, content):
+        """
+        套餐类型
+        """
+        if order_type == 0:
+            content = content + '(' + '云存' + ')'
+            return content
+        elif order_type == 1:
+            content = content + '(' + 'AI' + ')'
+            return content
+        elif order_type == 2:
+            pass