|
@@ -8,7 +8,6 @@
|
|
|
# @File : CronTaskController.py
|
|
|
# @Software: PyCharm
|
|
|
import datetime
|
|
|
-import logging
|
|
|
import time
|
|
|
|
|
|
import requests
|
|
@@ -21,7 +20,7 @@ from Ansjer.config import USED_SERIAL_REDIS_LIST, UNUSED_SERIAL_REDIS_LIST, CONF
|
|
|
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, OrdersSummary, DeviceInfoSummary, CompanySerialModel, \
|
|
|
- CloudLogModel, UidCloudStorageCount, UserExModel, DeviceDomainRegionModel
|
|
|
+ CloudLogModel, UidCloudStorageCount, UserExModel, DeviceDomainRegionModel, VodHlsTag, VodHlsTagType
|
|
|
from Object.RedisObject import RedisObject
|
|
|
from Object.ResponseObject import ResponseObject
|
|
|
from Object.utils import LocalDateTimeUtil
|
|
@@ -141,6 +140,7 @@ class CronDelDataView(View):
|
|
|
def delVodHls(response):
|
|
|
nowTime = int(time.time())
|
|
|
try:
|
|
|
+ CronDelDataView.del_vod_hls_tag()
|
|
|
cursor = connection.cursor()
|
|
|
month_ago_time = nowTime - 3 * 30 * 24 * 60 * 60 # 删除3个月前的数据
|
|
|
sql = 'DELETE FROM `vod_hls` WHERE endTime<{} LIMIT 50000'.format(month_ago_time)
|
|
@@ -153,6 +153,15 @@ class CronDelDataView(View):
|
|
|
except Exception as e:
|
|
|
return response.json(500, repr(e))
|
|
|
|
|
|
+ @staticmethod
|
|
|
+ def del_vod_hls_tag():
|
|
|
+ """
|
|
|
+ 删除AI标签记录
|
|
|
+ """
|
|
|
+ e_time = LocalDateTimeUtil.get_before_days_timestamp(int(time.time()), 30)
|
|
|
+ VodHlsTagType.objects.filter(created_time__lt=e_time).delete()
|
|
|
+ VodHlsTag.objects.filter(created_time__lt=e_time).delete()
|
|
|
+
|
|
|
@staticmethod
|
|
|
def delCloudLog(response):
|
|
|
nowTime = int(time.time())
|
|
@@ -375,11 +384,11 @@ class CronUpdateDataView(View):
|
|
|
break
|
|
|
|
|
|
# 状态为未使用,重置美洲服的地区id
|
|
|
- if status == 1: # 美洲服直接更新
|
|
|
+ if status == 1: # 美洲服直接更新
|
|
|
if CONFIG_INFO == CONFIG_US:
|
|
|
- DeviceDomainRegionModel.objects.filter(~Q(region_id=0), serial_number__in=serial_redis_list).\
|
|
|
+ DeviceDomainRegionModel.objects.filter(~Q(region_id=0), serial_number__in=serial_redis_list). \
|
|
|
update(region_id=0)
|
|
|
- else: # 其他服请求到美洲服更新
|
|
|
+ else: # 其他服请求到美洲服更新
|
|
|
req_url = 'https://www.dvema.com/cron/update/reset-region-id'
|
|
|
req_data = {
|
|
|
'serial_redis_list': str(serial_redis_list)
|