Sfoglia il codice sorgente

修改房间保存,已有房间名返回已存在

zhangdongming 3 anni fa
parent
commit
7396761bc9
1 ha cambiato i file con 1 aggiunte e 2 eliminazioni
  1. 1 2
      Controller/SensorGateway/EquipmentFamilyController.py

+ 1 - 2
Controller/SensorGateway/EquipmentFamilyController.py

@@ -728,8 +728,7 @@ class EquipmentFamilyView(View):
             room_qs = FamilyRoom.objects.filter(family_id=family_id, name=room_name)
 
             if room_qs.exists():
-                room_dict = {'updated_time': now_time, 'name': room_name}
-                room_qs.update(**room_dict)
+                return response.json(174)
             FamilyRoom.objects.create(family_id=family_id, name=room_name, updated_time=now_time,
                                       created_time=now_time)
         return response.json(0)