yf_yzl 2 jaren geleden
bovenliggende
commit
7e1efc394e
1 gewijzigde bestanden met toevoegingen van 3 en 2 verwijderingen
  1. 3 2
      smartfarming/views/device.py

+ 3 - 2
smartfarming/views/device.py

@@ -183,6 +183,7 @@ class CbdPhotoAPIView(APIView):
                 indentify_remote_content = requests.get(indentify).content
                 with open(indentify_photo, "wb") as f:
                     f.write(indentify_remote_content)
+                photo_time = request_data.get("photo_time")
                 data = {
                     "device_id": d_id,
                     "addr": addr_org.replace(media, "/media"),
@@ -190,8 +191,8 @@ class CbdPhotoAPIView(APIView):
                     "indentify_result": request_data.get("Result"),
                     "label": request_data.get("Result_code"),
                     "photo_status": 1,
-                    "uptime": int(time.time()),
-                    "addtime": int(time.time())
+                    "uptime": int(photo_time),
+                    "addtime": int(photo_time)
                 }
                 photo = MongoCBDphoto(**data)
                 photo.save()