Browse Source

优化房间删除,房间排序。

zhangdongming 3 years ago
parent
commit
19674ef3d7
1 changed files with 8 additions and 6 deletions
  1. 8 6
      SensorGateway/GatewayFamilyRoomController.py

+ 8 - 6
SensorGateway/GatewayFamilyRoomController.py

@@ -89,9 +89,10 @@ class GatewayFamilyRoomView(View):
         @param response: 响应参数
         @return:
         """
-        ids = request_dict.getlist('roomIds', None)
+        ids = request_dict.get('roomIds', None)
         if not ids:
             return response.json(444)
+        ids = ids.split(',')
         room_id = ids[0]
         room_info = FamilyRoom.objects.filter(id=room_id)
         if not room_info.exists():
@@ -120,13 +121,14 @@ class GatewayFamilyRoomView(View):
         @param response: 响应参数
         @return:
         """
-        ids = request_dict.getlist('ids', None)
+        ids = request_dict.get('ids', None)
         if not ids:
             return response.json(444)
-        for item in ids:
-            items = item.split(',')
-            room_id = items[0]
-            sort = items[1]
+        items = ids.split(',')
+        for item in items:
+            vals = item.split('-')
+            room_id = vals[0]
+            sort = vals[1]
             family_room = FamilyRoom.objects.filter(id=int(room_id))
             if family_room.exists():
                 family_room.update(sort=int(sort))