peng 2 роки тому
батько
коміт
343b3e9f02
1 змінених файлів з 3 додано та 3 видалено
  1. 3 3
      controller/deviceStatus.py

+ 3 - 3
controller/deviceStatus.py

@@ -621,10 +621,10 @@ class deviceStatus(TemplateView):
             return JsonResponse({'code': 111, 'msg': '参数异常'})
         skill_name = 'loocam'
         try:
-            switch_qs = SwitchModel.objects.filter(serial_number=serial_number).values('serial_number', 'userID')
+            switch_qs = SwitchModel.objects.filter(serial_number=serial_number)
             if not switch_qs.exists():
                 return JsonResponse({'code': 103, 'msg': '不存在socket数据'})
-            userID = switch_qs[0]['userID']
+            userID = switch_qs[0].userID
             alexAuth = AlexaAuthModel.objects.filter(userID=userID, skill_name=skill_name). \
                 values('expiresTime', 'refresh_token', 'access_token', 'alexa_region')
             if not alexAuth.exists():
@@ -655,7 +655,7 @@ class deviceStatus(TemplateView):
 
             endpoints = []
             for switch in switch_qs:
-                endpointId = {"endpointId": switch['serial_number']}
+                endpointId = {"endpointId": switch.serial_number}
                 endpoints.append(endpointId)
             switch_qs.delete()
             headers = {