| 
					
				 | 
			
			
				@@ -17,7 +17,7 @@ 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 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    RESET_REGION_ID_SERIAL_REDIS_LIST, LOGGER 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 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, \ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -28,8 +28,6 @@ from Object.utils import LocalDateTimeUtil 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from Service.CommonService import CommonService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from Service.VodHlsService import SplitVodHlsObject 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-LOGGER = logging.getLogger('info') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class CronDelDataView(View): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     def get(self, request, *args, **kwargs): 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -327,26 +325,25 @@ class CronUpdateDataView(View): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @classmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     def reqUpdateSerialStatus(cls, response): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         redis_obj = RedisObject() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        logger = logging.getLogger('info') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         # 更新已使用序列号其他服务器的状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         used_serial_redis_list = redis_obj.lrange(USED_SERIAL_REDIS_LIST, 0, -1)  # 读取redis已使用序列号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if used_serial_redis_list: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            logger.info('---请求更新已使用序列号列表---used_serial_redis_list:{}'.format(used_serial_redis_list)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LOGGER.info('---请求更新已使用序列号列表---used_serial_redis_list:{}'.format(used_serial_redis_list)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             used_serial_redis_list = [str(i, 'utf-8') for i in used_serial_redis_list] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             cls.do_request_function(used_serial_redis_list, 3) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         # 更新未使用序列号其他服务器的状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         unused_serial_redis_list = redis_obj.lrange(UNUSED_SERIAL_REDIS_LIST, 0, -1)  # 读取redis未使用序列号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if unused_serial_redis_list: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            logger.info('---请求更新未使用序列号列表---unused_serial_redis_list:{}'.format(unused_serial_redis_list)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LOGGER.info('---请求更新未使用序列号列表---unused_serial_redis_list:{}'.format(unused_serial_redis_list)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             unused_serial_redis_list = [str(i, 'utf-8') for i in unused_serial_redis_list] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             cls.do_request_function(unused_serial_redis_list, 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         # 重置地区id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         reset_region_id_serial_redis_list = redis_obj.lrange(RESET_REGION_ID_SERIAL_REDIS_LIST, 0, -1)  # 读取redis未使用序列号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if reset_region_id_serial_redis_list: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            logger.info('---请求重置地区id的序列号列表---:{}'.format(reset_region_id_serial_redis_list)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LOGGER.info('---请求重置地区id的序列号列表---:{}'.format(reset_region_id_serial_redis_list)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             reset_region_id_serial_redis_list = [str(i, 'utf-8') for i in reset_region_id_serial_redis_list] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             cls.do_request_reset_region_id(reset_region_id_serial_redis_list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return response.json(0) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -365,14 +362,13 @@ class CronUpdateDataView(View): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         # 确认域名列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         orders_domain_name_list = CommonService.get_orders_domain_name_list() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         redis_obj = RedisObject() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        logger = logging.getLogger('info') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        logger.info('---请求更新序列号线程---data:{},orders_domain_name_list:{}'.format(data, orders_domain_name_list)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LOGGER.info('---请求更新序列号线程---data:{},orders_domain_name_list:{}'.format(data, orders_domain_name_list)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             requests_failed_flag = False  # 请求失败标志位 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for domain_name in orders_domain_name_list: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 url = '{}cron/update/updateSerialStatus'.format(domain_name) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 response = requests.post(url=url, data=data, timeout=5) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                logger.info('---请求更新序列号响应时间---:{}'.format(response.elapsed.total_seconds())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                LOGGER.info('---请求更新序列号响应时间---:{}'.format(response.elapsed.total_seconds())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 result = response.json() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if result['result_code'] != 0:  # 请求失败标志位置位 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     requests_failed_flag = True 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -389,7 +385,7 @@ class CronUpdateDataView(View): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             'serial_redis_list': str(serial_redis_list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         response = requests.post(url=req_url, data=req_data, timeout=5) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        logger.info('---请求重置地区id响应时间---:{}'.format(response.elapsed.total_seconds())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        LOGGER.info('---请求重置地区id响应时间---:{}'.format(response.elapsed.total_seconds())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         result = response.json() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if result['result_code'] != 0:  # 请求失败标志位置位 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             requests_failed_flag = True 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -403,7 +399,7 @@ class CronUpdateDataView(View): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     for i in serial_redis_list: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         redis_obj.lrem(USED_SERIAL_REDIS_LIST, 0, i) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            logger.info('---更新序列号状态异常---:{}'.format(repr(e))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LOGGER.info('---更新序列号状态异常---:{}'.format(repr(e))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @staticmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     def do_request_reset_region_id(reset_region_id_serial_redis_list): 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -412,7 +408,6 @@ class CronUpdateDataView(View): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         @param reset_region_id_serial_redis_list: 序列号redis列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         redis_obj = RedisObject() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        logger = logging.getLogger('info') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         requests_failed_flag = False  # 请求失败标志位 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             'serial_redis_list': str(reset_region_id_serial_redis_list), 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -428,7 +423,7 @@ class CronUpdateDataView(View): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 for serial in reset_region_id_serial_redis_list: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     redis_obj.lrem(RESET_REGION_ID_SERIAL_REDIS_LIST, 0, serial) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            logger.info('---请求重置地区id异常---:{}'.format(repr(e))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LOGGER.info('---请求重置地区id异常---:{}'.format(repr(e))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @staticmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     def updateSerialStatus(request_dict, response): 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -441,8 +436,7 @@ class CronUpdateDataView(View): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         serial_redis_list = request_dict.get('serial_redis_list', None) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         status = request_dict.get('status', None) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        logger = logging.getLogger('info') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        logger.info('---更新序列号状态参数---serial_redis_list:{},status:{}'.format(serial_redis_list, status)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LOGGER.info('---更新序列号状态参数---serial_redis_list:{},status:{}'.format(serial_redis_list, status)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if not all([serial_redis_list, status]): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return response.json(444) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         now_time = int(time.time()) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -452,7 +446,7 @@ class CronUpdateDataView(View): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                                           update_time=now_time) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return response.json(0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            logger.info('---更新序列号状态异常---:{}'.format(repr(e))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LOGGER.info('---更新序列号状态异常---:{}'.format(repr(e))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return response.json(500) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @staticmethod 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -464,8 +458,7 @@ class CronUpdateDataView(View): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         @param response: 响应对象 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         serial_redis_list = request_dict.get('serial_redis_list', None) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        logger = logging.getLogger('info') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        logger.info('---重置地区id参数---serial_redis_list:{}'.format(serial_redis_list)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LOGGER.info('---重置地区id参数---serial_redis_list:{}'.format(serial_redis_list)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if not serial_redis_list: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return response.json(444) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try: 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -473,7 +466,7 @@ class CronUpdateDataView(View): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             DeviceDomainRegionModel.objects.filter(serial_number__in=serial_redis_list).update(region_id=0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return response.json(0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            logger.info('---重置地区id异常---:{}'.format(repr(e))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LOGGER.info('---重置地区id异常---:{}'.format(repr(e))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return response.json(500) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |