Explorar o código

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

yf_fyh %!s(int64=2) %!d(string=hai) anos
pai
achega
caa4304adf
Modificáronse 1 ficheiros con 8 adicións e 5 borrados
  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})