ソースを参照

Merge remote-tracking branch 'origin/master' into dev-frontend

panqiuyao 11 ヶ月 前
コミット
644044f997
2 ファイル変更15 行追加7 行削除
  1. 1 1
      python/config.ini
  2. 14 6
      python/services/deal_cutout.py

+ 1 - 1
python/config.ini

@@ -2,7 +2,7 @@
 host=127.0.0.1
 port=7074
 debug=false
-env=dev
+env=prod
 [dev]
 origin= http://my2.pubdata.cn
 host= mybackend2.pubdata.cn

+ 14 - 6
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,
@@ -246,6 +246,7 @@ 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
@@ -253,9 +254,16 @@ 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"]
-            save_path = f"{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"{save_root_path}/已扣图"
             check_path(save_path)
         else:
             return is_finished, successCount, failCount, root_path