Переглянути джерело

修复吸虫塔图片对接出现"0"

yf_fyh 2 роки тому
батько
коміт
caa4304adf
1 змінених файлів з 8 додано та 5 видалено
  1. 8 5
      apps/Equipment/views.py

+ 8 - 5
apps/Equipment/views.py

@@ -803,12 +803,15 @@ class XctDevicePhotoView(APIView):
             Result = item["indentify_result"] if item["indentify_result"] else "0"
             indentify_photo = item["indentify_photo"]
             if indentify_photo and indentify_photo!="0":
-                if indentify_photo.startswith("http"):
-                    Result_image = indentify_photo
-                elif indentify_photo.startswith("/"):
-                    Result_image = settings.CONFIG["image_url"]["xct_img_result_forward"] + indentify_photo
+                if indentify_photo == "0":
+                    Result_image = "0"
                 else:
-                    Result_image = settings.CONFIG["image_url"]["xct_img_result_forward"] + "/" + indentify_photo
+                    if indentify_photo.startswith("http"):
+                        Result_image = indentify_photo
+                    elif indentify_photo.startswith("/"):
+                        Result_image = settings.CONFIG["image_url"]["xct_img_result_forward"] + indentify_photo
+                    else:
+                        Result_image = settings.CONFIG["image_url"]["xct_img_result_forward"] + "/" + indentify_photo
             else:
                 Result_image = "0"
             result.append({"uptime":item["addtime"],"Image":Image,"Result_image":Result_image,"Result":Result})