| 
					
				 | 
			
			
				@@ -19,7 +19,7 @@ import logging 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from boto3.session import Session 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from django.http import JsonResponse, HttpResponseRedirect, HttpResponse 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from django.views.generic.base import View 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-from Model.models import Device_Info 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+from Model.models import Device_Info, DeviceLogModel 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from Object.ResponseObject import ResponseObject 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from Object.TokenObject import TokenObject 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from Object.UidTokenObject import UidTokenObject 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -54,6 +54,8 @@ class DeviceDebug(View): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return self.single_debug(request, request_dict, uid, response) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return response.json(444, 'operation') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if operation == 'deviceException': 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return self.device_exception(request, request_dict, response) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return response.json(309) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     def single_debug(self,request, request_dict, uid, response): 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -73,3 +75,29 @@ class DeviceDebug(View): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         device_info.info("debug------------------------------------------------------------------------------------end") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return response.json(0,'debug success') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 # return response.json(10, '生成失败') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    #c1 pro设备上传异常日志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    def device_exception(self,request, request_dict, response): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        uid = request_dict.get('uid', None) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        serial_number = request_dict.get('serial_number', None) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        error_info = request_dict.get('error_info', None) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        # uid,serial_number二传一 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if not (uid or serial_number): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return response.json(444) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            data_dict = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'error_info': error_info, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'status': 3, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'ip': CommonService.get_ip_address(request), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if uid: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                data_dict['uid'] = CommonService.decode_data(uid) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                data_dict['serial_number'] = CommonService.decode_data(serial_number) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DeviceLogModel.objects.create(**data_dict) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return response.json(0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        except Exception as e: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            print(e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return response.json(500, repr(e)) 
			 |