Explorar o código

没有房间则保留返回结果

zhangdongming %!s(int64=3) %!d(string=hai) anos
pai
achega
82ca5eea64
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      SensorGateway/EquipmentFamilyController.py

+ 1 - 1
SensorGateway/EquipmentFamilyController.py

@@ -698,7 +698,7 @@ class EquipmentFamilyView(View):
         room_qs = room_qs.values('id', 'name', 'sort')
         room_list = []
         if not room_qs.exists():
-            return response.json(0, room_list)
+            return response.json(0, {'total': 0, 'data': room_list, 'deviceTotal': 0})
         for item in room_qs:
             item['deviceCount'] = FamilyRoomDevice.objects.filter(family_id=family_id, room_id=item['id']).count()
             room_list.append(item)