Просмотр исходного кода

```
fix(customer-template-service): 修复图片处理逻辑中的变量赋值问题

- 将 model_image 和 scene_image 的检查条件从 `not` 改为 `is None`
- 优化变量命名,使用 model_image_path 和 scene_image_path 分别存储原始路径
- 确保只有在图片路径存在时才进行变量赋值和文件复制操作
- 保持原有的图片复制功能不变
```

rambo 3 недель назад
Родитель
Сommit
0c4a2a70fa
1 измененных файлов с 10 добавлено и 8 удалено
  1. 10 8
      python/service/customer_template_service.py

+ 10 - 8
python/service/customer_template_service.py

@@ -219,14 +219,16 @@ class CustomerTemplateService:
             goods_art_no = product.get("货号",None)
             goods_art_lens = len(new_config_data.get("货号资料", []))
             concat_shuffix = "" if goods_art_lens == 1 else f"_{goods_art_no}"
-            if not model_image:
-                model_image = product.get("模特图", None)
-                if model_image:
-                    self.copyImage(model_image, f"{scp_path}/模特图{concat_shuffix}.jpg")
-            if not scene_image:
-                scene_image = product.get("场景图", None)
-                if scene_image:
-                    self.copyImage(scene_image, f"{scp_path}/场景图{concat_shuffix}.jpg")
+            if model_image is None:
+                model_image_path = product.get("模特图", None)
+                if model_image_path:
+                    model_image = model_image_path
+                    self.copyImage(model_image_path, f"{scp_path}/模特图{concat_shuffix}.jpg")
+            if scene_image  is None:
+                scene_image_path = product.get("场景图", None)
+                if scene_image_path:
+                    scene_image = scene_image_path
+                    self.copyImage(scene_image_path, f"{scp_path}/场景图{concat_shuffix}.jpg")
             new_pics = {}
             for pic_key, pic_path in pics.items():
                 if "-抠图" in pic_key: