Преглед на файлове

DVR判断''改为"";智能场景,优化为可删除多个

guanhailong преди 3 години
родител
ревизия
eec77f6f3c
променени са 2 файла, в които са добавени 10 реда и са изтрити 8 реда
  1. 1 1
      Controller/EquipmentManagerV3.py
  2. 9 7
      Controller/SensorGateway/SmartSceneController.py

+ 1 - 1
Controller/EquipmentManagerV3.py

@@ -100,7 +100,7 @@ class EquipmentManagerV3(View):
 
 
         dvr_type_list = [1, 2, 3, 4, 10001]
         dvr_type_list = [1, 2, 3, 4, 10001]
         if Type in dvr_type_list:
         if Type in dvr_type_list:
-            View_Password = ''
+            View_Password = ""
         else:
         else:
             View_Password = 'admin'
             View_Password = 'admin'
 
 

+ 9 - 7
Controller/SensorGateway/SmartSceneController.py

@@ -96,7 +96,7 @@ class SmartSceneView(View):
                 device_id = sub_device_qs[0]['device_id']
                 device_id = sub_device_qs[0]['device_id']
                 device_type = sub_device_qs[0]['device_type']
                 device_type = sub_device_qs[0]['device_type']
 
 
-                if device_type != 216:  # 非216返回网关
+                if device_type != 216:  # 非智能按钮只返回网关
                     res = [cls.get_gateway_data(device_id)]
                     res = [cls.get_gateway_data(device_id)]
                 else:
                 else:
                     gateway_data = cls.get_gateway_data(device_id)
                     gateway_data = cls.get_gateway_data(device_id)
@@ -380,16 +380,18 @@ class SmartSceneView(View):
         """
         """
         删除智能场景
         删除智能场景
         @param request_dict: 请求参数
         @param request_dict: 请求参数
-        @request_dict smartSceneId: 智能场景id
+        @request_dict smartSceneIds: 智能场景id
         @param response: 响应对象
         @param response: 响应对象
         @return: response
         @return: response
         """
         """
-        smart_scene_id = request_dict.get('smartSceneId', None)
+        smart_scene_ids = request_dict.get('smartSceneIds', None)
 
 
-        if not smart_scene_id:
-            return response.json(444, {'error param': 'smartSceneId'})
+        if not smart_scene_ids:
+            return response.json(444, {'error param': 'smartSceneIds'})
         try:
         try:
-            SmartScene.objects.filter(id=smart_scene_id).delete()
-            return response.json(0)
+            SmartScene.objects.filter(id__in=smart_scene_ids.split(',')).delete()
         except Exception as e:
         except Exception as e:
             return response.json(500, repr(e))
             return response.json(500, repr(e))
+        else:
+            return response.json(0)
+