|
@@ -21,12 +21,13 @@ 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, CONFIG_INFO, CONFIG_US, \
|
|
|
- RESET_REGION_ID_SERIAL_REDIS_LIST, LOGGER, PAYPAL_CRD, CONFIG_EUR
|
|
|
+ RESET_REGION_ID_SERIAL_REDIS_LIST, LOGGER, PAYPAL_CRD, CONFIG_EUR, DETECT_PUSH_DOMAINS
|
|
|
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, VodHlsTag, VodHlsTagType, \
|
|
|
- Store_Meal, Lang, VodBucketModel, UnicomComboOrderInfo, UnicomDeviceInfo, AbnormalOrder, DailyReconciliation
|
|
|
+ Store_Meal, Lang, VodBucketModel, UnicomComboOrderInfo, UnicomDeviceInfo, AbnormalOrder, DailyReconciliation, \
|
|
|
+ CustomizedPush
|
|
|
from Object.RedisObject import RedisObject
|
|
|
from Object.ResponseObject import ResponseObject
|
|
|
from Object.utils import LocalDateTimeUtil
|
|
@@ -423,6 +424,8 @@ class CronUpdateDataView(View):
|
|
|
return self.reset_region_id(request_dict, response)
|
|
|
elif operation == 'updateVodMeal': # 定时修改体验套餐有效期为1个月
|
|
|
return self.update_vod_meal(request_dict, response)
|
|
|
+ elif operation == 'checkCustomizedPush': # 定时检查定制化推送,重新执行没有推送成功的请求
|
|
|
+ return self.check_customized_push(response)
|
|
|
else:
|
|
|
return response.json(404)
|
|
|
|
|
@@ -686,6 +689,22 @@ class CronUpdateDataView(View):
|
|
|
LOGGER.info('---修改云存套餐内容异常---:{}'.format(repr(e)))
|
|
|
return response.json(500)
|
|
|
|
|
|
+ @staticmethod
|
|
|
+ def check_customized_push(response):
|
|
|
+ try:
|
|
|
+ now_time = int(time.time())
|
|
|
+ # 查询推送时间小于当前时间且推送状态为待推送的数据
|
|
|
+ customized_push_qs = CustomizedPush.objects.filter(push_timestamp__lt=now_time, push_satus=0).values('id')
|
|
|
+ if customized_push_qs.exists():
|
|
|
+ for customized_push in customized_push_qs:
|
|
|
+ customized_push_id = customized_push['id']
|
|
|
+ data = {'customized_push_id': customized_push_id}
|
|
|
+ url = DETECT_PUSH_DOMAINS + 'customized_push/start'
|
|
|
+ req = requests.post(url=url, data=data, timeout=8)
|
|
|
+ return response.json(0)
|
|
|
+ except Exception as e:
|
|
|
+ return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
+
|
|
|
|
|
|
class CronCollectDataView(View):
|
|
|
def get(self, request, *args, **kwargs):
|