rambo hace 11 meses
padre
commit
78e28c825a
Se han modificado 1 ficheros con 12 adiciones y 5 borrados
  1. 12 5
      python/services/deal_cutout.py

+ 12 - 5
python/services/deal_cutout.py

@@ -174,14 +174,14 @@ class DealModelForm:
     def startDispose(self):
         self.get_online_data.refresh_headers()
         num = 0
-        save_root_path = ""
         baseImages = []
         resize = 1600  # 定义标准
+        root_path_list = []
         for index, image_data in enumerate(self.need_cutout_images):
             if image_data["need_cutout"] == False:
                 continue
             num += 1
-            save_root_path = image_data["root_path"]
+            root_path_list.append(image_data["root_path"])
             file_path = image_data["file_path"]
             original_pic = Picture(file_path)
             if original_pic.x > original_pic.y:
@@ -229,6 +229,7 @@ class DealModelForm:
                     False,
                 ]
             )
+        save_root_path = min(root_path_list)
         # self.addData2Csv(saveParams)
         return self.need_cutout_images, save_root_path, generate_ids
 
@@ -238,7 +239,6 @@ class DealModelForm:
         # except FileNotFoundError as e:
         #     raise UnicornException("不存在生成记录,请先提交抠人台抠图任务")
         """进度查询"""
-        print("self.params", self.params)
         search_generate_ids = self.params.generate_ids
         dataParams = {
             "generate_ids": search_generate_ids,
@@ -253,8 +253,15 @@ class DealModelForm:
         if generate_ids is None:
             raise UnicornException("参数异常")
         if len(generate_ids) > 0:
-            print("generate_ids", generate_ids)
-            root_path = generate_ids[0]["root_path"]
+            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)
             save_path = f"{root_path}/已扣图"
             check_path(save_path)
         else: