|
@@ -21,12 +21,13 @@ from Model.models import Device_User, Device_Info, UidSetModel, UID_Bucket, Unus
|
|
|
VodHlsModel, ExperienceContextModel, AiService, VodHlsSummary, VideoPlaybackTimeModel, DeviceUserSummary, \
|
|
|
CountryModel, DeviceTypeModel, OrdersSummary, DeviceInfoSummary, CompanySerialModel, \
|
|
|
CloudLogModel, UidCloudStorageCount, UserExModel, DeviceDomainRegionModel, VodHlsTag, VodHlsTagType, IcloudService, \
|
|
|
- Store_Meal, Lang, VodBucketModel
|
|
|
+ Store_Meal, Lang, VodBucketModel, UnicomComboOrderInfo
|
|
|
from Object.RedisObject import RedisObject
|
|
|
from Object.ResponseObject import ResponseObject
|
|
|
from Object.utils import LocalDateTimeUtil
|
|
|
from Service.CommonService import CommonService
|
|
|
from Service.VodHlsService import SplitVodHlsObject
|
|
|
+from Object.UnicomObject import UnicomObjeect
|
|
|
|
|
|
|
|
|
class CronDelDataView(View):
|
|
@@ -569,25 +570,33 @@ class CronUpdateDataView(View):
|
|
|
elif lang == 'en':
|
|
|
Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(content='1-Month plan (free trial)')
|
|
|
elif lang == 'es':
|
|
|
- Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(content='Plan de 1 mes (prueba gratuita)')
|
|
|
+ Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(
|
|
|
+ content='Plan de 1 mes (prueba gratuita)')
|
|
|
elif lang == 'fr':
|
|
|
- Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(content='Forfait de 1 mois (essai gratuit)')
|
|
|
+ Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(
|
|
|
+ content='Forfait de 1 mois (essai gratuit)')
|
|
|
elif lang == 'de':
|
|
|
- Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(content='1 Monat Paket (kostenlose Testversion) ')
|
|
|
+ Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(
|
|
|
+ content='1 Monat Paket (kostenlose Testversion) ')
|
|
|
elif lang == 'cn_tw':
|
|
|
Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(content='一個月套餐(免費試用)')
|
|
|
elif lang == 'pt':
|
|
|
- Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(content='Plano de 1 mês (teste gratuito)')
|
|
|
+ Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(
|
|
|
+ content='Plano de 1 mês (teste gratuito)')
|
|
|
elif lang == 'ru':
|
|
|
- Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(content='Тариф 1 месяц (бесплатный пробный период)')
|
|
|
+ Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(
|
|
|
+ content='Тариф 1 месяц (бесплатный пробный период)')
|
|
|
elif lang == 'ja':
|
|
|
Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(content='1ヶ月プラン(無料試用)')
|
|
|
elif lang == 'it':
|
|
|
- Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(content='Pacchetto di 1 mese (prova gratuita)')
|
|
|
+ Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(
|
|
|
+ content='Pacchetto di 1 mese (prova gratuita)')
|
|
|
elif lang == 'pl':
|
|
|
- Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(content='jednomiesięczny pakiet (bezpłatny próbny)')
|
|
|
+ Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(
|
|
|
+ content='jednomiesięczny pakiet (bezpłatny próbny)')
|
|
|
elif lang == 'nl':
|
|
|
- Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(content='Pakket van 1 maand (gratis proefperiode)')
|
|
|
+ Lang.objects.filter(lang=lang, store_meal__id=meal_id).update(
|
|
|
+ content='Pakket van 1 maand (gratis proefperiode)')
|
|
|
VodBucketModel.objects.filter(id=meal_qs[0]['bucket']).update(content='国内存储桶免费体验30天,录像保存7天')
|
|
|
meal_qs.update(expire=1)
|
|
|
return response.json(0)
|
|
@@ -595,6 +604,7 @@ class CronUpdateDataView(View):
|
|
|
LOGGER.info('---修改体验套餐有效期---:{}'.format(repr(e)))
|
|
|
return response.json(500)
|
|
|
|
|
|
+
|
|
|
class CronCollectDataView(View):
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
request.encoding = 'utf-8'
|
|
@@ -618,6 +628,8 @@ class CronCollectDataView(View):
|
|
|
return self.collect_icloud_order(response)
|
|
|
elif operation == 'collectDeviceInfo': # 定时保存设备数据
|
|
|
return self.collect_device_info(response)
|
|
|
+ elif operation == 'collectFlowInfo': # 定时保存设备数据
|
|
|
+ return self.collect_flow_info(response)
|
|
|
else:
|
|
|
return response.json(404)
|
|
|
|
|
@@ -1243,3 +1255,30 @@ class CronCollectDataView(View):
|
|
|
return response.json(0)
|
|
|
except Exception as e:
|
|
|
return response.json(500, repr(e))
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def collect_flow_info(response):
|
|
|
+ try:
|
|
|
+ redis_obj = RedisObject()
|
|
|
+ unicom_qs = UnicomComboOrderInfo.objects.filter(combo__combo_type__in=[0, 1, 2]).values('iccid')
|
|
|
+ unicom_api = UnicomObjeect()
|
|
|
+ for item in unicom_qs:
|
|
|
+ res = unicom_api.query_device_usage_history(**item)
|
|
|
+ if res.status_code == 200:
|
|
|
+ res_json = res.json()
|
|
|
+ if res_json['code'] == 0:
|
|
|
+ redis_dict = {}
|
|
|
+ for data in res_json['data']['deviceUsageHistory']:
|
|
|
+ year = data.get('year', None)
|
|
|
+ month = data.get('month', None)
|
|
|
+ flow = data.get('flowTotalUsage', None)
|
|
|
+ if not all([year, month, flow]):
|
|
|
+ continue
|
|
|
+ file = str(year) + '-' + str(month)
|
|
|
+ redis_dict[file] = flow
|
|
|
+ key = 'monthly' + item['iccid']
|
|
|
+ if redis_dict:
|
|
|
+ redis_obj.set_hash_data(key, redis_dict)
|
|
|
+ return response.json(0)
|
|
|
+ except Exception as e:
|
|
|
+ return response.json(500, repr(e))
|