Browse Source

增加不更新配置文件条件

yf_yzl 2 năm trước cách đây
mục cha
commit
41c122dc35
1 tập tin đã thay đổi với 5 bổ sung4 xóa
  1. 5 4
      smartfarming/api/views/forecast/send_control.py

+ 5 - 4
smartfarming/api/views/forecast/send_control.py

@@ -433,10 +433,11 @@ def admin_device_control(request):
     logger.warning(f"设备的返回值:{response}")
     response_code = response.status_code
     if response_code == 200:
-        device_config = MongoDeviceConfig.objects.get(d_id=d_id)
-        device_config.device_config = str(payload)
-        device_config.save()
-        logger.warning(f"修改设备{d_id} 成功: {str(payload)}")
+        if cmd not in ["takephoto"]:
+            device_config = MongoDeviceConfig.objects.get(d_id=d_id)
+            device_config.device_config = str(payload)
+            device_config.save()
+            logger.warning(f"修改设备{d_id} 成功: {str(payload)}")
         return True
     else:
         return False