Procházet zdrojové kódy

Merge branch 'dev-python'

rambo před 11 měsíci
rodič
revize
7ba504843e
1 změnil soubory, kde provedl 6 přidání a 14 odebrání
  1. 6 14
      python/services/deal_cutout.py

+ 6 - 14
python/services/deal_cutout.py

@@ -246,27 +246,19 @@ class DealModelForm:
         }
         responseData = self.get_online_data.search_progress(dataParams)
         generate_ids = self.params.result
-        save_root_path = self.params.save_root_path
         successCount = 0
         failCount = 0
         is_finished = False
-        root_path = ""
+        save_root_path = ""
         if generate_ids is None:
             raise UnicornException("参数异常")
         if len(generate_ids) > 0:
-            # root_path_list = list(map(lambda x: x.get("root_path"), generate_ids))
-            # root_path = ""
-            # for root_path_item in root_path_list:
-            #     if root_path == "":
-            #         root_path = root_path_item
-            #     else:
-            #         if len(root_path_item) < len(root_path):
-            #             root_path = root_path_item
-            # print("root_path", root_path)
+            root_path_list = list(map(lambda x: x.get("root_path"), generate_ids))
+            save_root_path = min(root_path_list)
             save_path = f"{save_root_path}/已扣图"
             check_path(save_path)
         else:
-            return is_finished, successCount, failCount, root_path
+            return is_finished, successCount, failCount, ""
         for idx, generate in enumerate(generate_ids):
             for respItem in responseData:
                 try:
@@ -283,7 +275,7 @@ class DealModelForm:
                     successCount += 1
                     result_image_url = respItem["result_image_urls"][0]
                     result_image_pil = urlPilImage(result_image_url)
-                    root_path = generate["root_path"]
+                    # root_path = generate["root_path"]
                     file_name = generate["file_name"]
                     file_e = generate["file_e"]
                     if result_image_pil.mode == "RGBA":
@@ -294,4 +286,4 @@ class DealModelForm:
         is_finished = (
             True if len(search_generate_ids) == (successCount + failCount) else False
         )
-        return is_finished, successCount, failCount, root_path
+        return is_finished, successCount, failCount, save_root_path