rambo vor 4 Monaten
Ursprung
Commit
18473b3331

+ 68 - 44
python/api.py

@@ -383,40 +383,63 @@ async def process_handle_detail(request: Request, params: HandlerDetail):
     move_folder_array = check_move_goods_art_no_folder(
         "output", goods_art_no_arrays, limit_path
     )
-    for goods_art_no in goods_art_no_arrays:
-        if not goods_art_no:
-            raise UnicornException("货号不能为空")
-        session = SqlQuery()
-        pr = CRUD(PhotoRecord)
-        images = pr.read_all(session, conditions={"goods_art_no": goods_art_no})
-        if not images:
-            raise UnicornException("没有可用货号数据")
-        if is_only_cutout != 1:
-            detail_counts = len(params.template_image_order.split(","))
-            image_counts = len(images)
-            if image_counts < detail_counts:
-                raise UnicornException(
-                    f"货号:[{goods_art_no}],实际照片数量:{image_counts}张,小于详情图要求数量:{detail_counts}张"
-                )
-        if move_folder_array.get(goods_art_no) == None:
-            image_dir = "{}/data/".format(os.getcwd()).replace("\\", "/")
-            check_path(image_dir)
-            for idx, itemImg in enumerate(images):
-                if itemImg.image_path == "" or itemImg.image_path == None:
+    try:
+        for goods_art_no in goods_art_no_arrays:
+            if not goods_art_no:
+                raise UnicornException("货号不能为空")
+            session = SqlQuery()
+            pr = CRUD(PhotoRecord)
+            images = pr.read_all(session, conditions={"goods_art_no": goods_art_no})
+            if not images:
+                raise UnicornException("没有可用货号数据")
+            if is_only_cutout != 1:
+                detail_counts = len(params.template_image_order.split(","))
+                image_counts = len(images)
+                if image_counts < detail_counts:
                     raise UnicornException(
-                        f"货号【{goods_art_no}】存在没有拍摄完成的图片,请重拍或删除后重试"
+                        f"货号:[{goods_art_no}],实际照片数量:{image_counts}张,小于详情图要求数量:{detail_counts}张"
                     )
-                new_file_name = str(itemImg.goods_art_no) + "_" + str(idx) + ".jpg"
-                if not os.path.exists(
-                    image_dir + "/" + os.path.basename(new_file_name)
-                ):
-                    shutil.copy(itemImg.image_path, image_dir + new_file_name)
-            dealImage = DealImage(image_dir)
-            resFlag, path = dealImage.dealMoveImage(
-                image_dir=image_dir, callback_func=None, goods_art_no=goods_art_no
-            )
-            if not resFlag:
-                raise UnicornException(path)
+            if move_folder_array.get(goods_art_no) == None:
+                image_dir = "{}/data/".format(os.getcwd()).replace("\\", "/")
+                check_path(image_dir)
+                for idx, itemImg in enumerate(images):
+                    if itemImg.image_path == "" or itemImg.image_path == None:
+                        raise UnicornException(
+                            f"货号【{goods_art_no}】存在没有拍摄完成的图片,请重拍或删除后重试"
+                        )
+                    new_file_name = str(itemImg.goods_art_no) + "_" + str(idx) + ".jpg"
+                    if not os.path.exists(
+                        image_dir + "/" + os.path.basename(new_file_name)
+                    ):
+                        shutil.copy(itemImg.image_path, image_dir + new_file_name)
+                dealImage = DealImage(image_dir)
+                resFlag, path = dealImage.dealMoveImage(
+                    image_dir=image_dir, callback_func=None, goods_art_no=goods_art_no
+                )
+                if not resFlag:
+                    raise UnicornException(path)
+    except UnicornException as e:
+        handler_result_folder = ""
+        handler_result = e.msg
+        print(f"UnicornException 生成错误信息:{e}")
+        await sendAsyncMessage(
+            msg="处理结束",
+            data={"output_folder": handler_result_folder, "list": handler_result},
+            status="处理结束",
+            msg_type="detail_result_progress",
+        )
+        return True
+    except Exception as e:
+        print(f"详情图生成错误信息:{e}")
+        handler_result_folder = ""
+        handler_result.append({"goods_art_no": "", "success": False, "info": str(e)})
+        await sendAsyncMessage(
+            msg="处理结束",
+            data={"output_folder": handler_result_folder, "list": handler_result},
+            status="处理结束",
+            msg_type="detail_result_progress",
+        )
+        return True
     # try:
     temp_class = {}
     temp_name_list = []
@@ -495,19 +518,20 @@ async def process_handle_detail(request: Request, params: HandlerDetail):
             msg_type="detail_result_progress",
         )
         return True
-    if is_product_scene == 1:
-        if product_scene_prompt == "" or product_scene_prompt == None:
-            raise UnicornException("请填写场景描述")
-    if is_upper_footer == 1:
-        if upper_footer_params == {} or upper_footer_params == None:
-            raise UnicornException("请选择模特")
-        man_id = upper_footer_params.get("man_id")
-        if not man_id:
-            raise UnicornException("请选择男模特")
-        women_id = upper_footer_params.get("women_id")
-        if not women_id:
-            raise UnicornException("请选择女模特")
+
     try:
+        if is_product_scene == 1:
+            if product_scene_prompt == "" or product_scene_prompt == None:
+                raise UnicornException("请填写场景描述")
+        if is_upper_footer == 1:
+            if upper_footer_params == {} or upper_footer_params == None:
+                raise UnicornException("请选择模特")
+            man_id = upper_footer_params.get("man_id")
+            if not man_id:
+                raise UnicornException("请选择男模特")
+            women_id = upper_footer_params.get("women_id")
+            if not women_id:
+                raise UnicornException("请选择女模特")
         return_data_check_before_detail = run_main.check_before_detail(config_data)
         print("报错前返回的结果数据", return_data_check_before_detail)
         if is_product_scene == 1:

+ 167 - 82
python/custom_plugins/plugins/detail_template/huilima/detail_huilima2.py

@@ -4,6 +4,7 @@
 2、整理所有相关的图片作为素材图
 3、按要求进行拼接
 """
+
 import os
 from PIL import ImageFont
 import sys
@@ -30,15 +31,31 @@ template_name = "huilima-2"
 
 # 皮鞋模板
 
+
 class DetailPicGet(DetailBase):
     need_view = ["俯视", "侧视", "后跟", "鞋底", "内里"]
     root = r"{}\resources\detail_temp\huilima\2".format(os.getcwd())
 
-    def __init__(self, goods_no, goods_no_value: dict, out_put_dir, windows=None, test=False, excel_data=None,
-                 assigned_page_list=None, **kwargs):
-
-        super().__init__(goods_no, goods_no_value, out_put_dir, windows=windows, excel_data=excel_data,
-                         assigned_page_list=assigned_page_list)
+    def __init__(
+        self,
+        goods_no,
+        goods_no_value: dict,
+        out_put_dir,
+        windows=None,
+        test=False,
+        excel_data=None,
+        assigned_page_list=None,
+        **kwargs
+    ):
+
+        super().__init__(
+            goods_no,
+            goods_no_value,
+            out_put_dir,
+            windows=windows,
+            excel_data=excel_data,
+            assigned_page_list=assigned_page_list,
+        )
 
         self.template_name = template_name
         self.root = r"{}\resources\detail_temp\huilima\2".format(os.getcwd())
@@ -70,7 +87,11 @@ class DetailPicGet(DetailBase):
         img = self.add_pic(detailed_images)
         if img:
             self.create_folder(r"{}/{}".format(self.out_put_dir, template_name))
-            img.save(r"{}/{}/{}.jpg".format(self.out_put_dir, template_name, self.goods_no, format="JPEG"))
+            img.save(
+                r"{}/{}/{}.jpg".format(
+                    self.out_put_dir, template_name, self.goods_no, format="JPEG"
+                )
+            )
             img.show()
 
     # 斜视图展示
@@ -80,13 +101,18 @@ class DetailPicGet(DetailBase):
         detailed_images.append(pp_bg)
         goods_art_no_list = list(self.data.keys())
         # ----粘贴俯视图
-        pp_jpg = self.get_overlay_pic_from_dict(goods_art_no=goods_art_no_list[0],
-                                                color_name="俯视",
-                                                bg_color=self.base_bg_color)
+        pp_jpg = self.get_overlay_pic_from_dict(
+            goods_art_no=goods_art_no_list[0],
+            color_name="俯视",
+            bg_color=self.base_bg_color,
+        )
         pp_jpg = pp_jpg.resize(value=1098)
         pp_jpg = pp_jpg.paste_img_invert(
-            top_img=PictureProcessing("RGB", (1600, pp_jpg.height + 100), self.base_bg_color),
-            base="cc")
+            top_img=PictureProcessing(
+                "RGB", (1600, pp_jpg.height + 100), self.base_bg_color
+            ),
+            base="cc",
+        )
         detailed_images.append(pp_jpg)
         return PictureProcessing(im=self.add_pic(detailed_images))
 
@@ -104,89 +130,107 @@ class DetailPicGet(DetailBase):
         detailed_images = []
         goods_art_no_list = list(self.data.keys())
         # =====添加侧视图
-        pp_jpg = self.get_overlay_pic_from_dict(goods_art_no=goods_art_no_list[0],
-                                                color_name="侧视",
-                                                bg_color=self.base_bg_color)
+        pp_jpg = self.get_overlay_pic_from_dict(
+            goods_art_no=goods_art_no_list[0],
+            color_name="侧视",
+            bg_color=self.base_bg_color,
+        )
         pp_jpg = pp_jpg.resize(value=1098)
         pp_jpg = pp_jpg.paste_img_invert(
-            top_img=PictureProcessing("RGB", (1600, pp_jpg.height + 100), self.base_bg_color),
-            base="cc")
+            top_img=PictureProcessing(
+                "RGB", (1600, pp_jpg.height + 100), self.base_bg_color
+            ),
+            base="cc",
+        )
         detailed_images.append(pp_jpg)
 
         font_1 = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 48)  # 颜色名称
         # =====添加鞋面描述
         pp_bg_2 = PictureProcessing(r"{}\7.jpg".format(self.root))
         text = self.get_text_value("提示1主标题")
-        if text:
-            _pp = PictureProcessing().get_text_image_advanced(
-                font=font_1,
-                text=text,
-                fill=(122, 122, 122),
-                return_mode="min_image",
-            )
-            pp_bg_2 = pp_bg_2.paste_img(top_img=_pp, value=(143, 166), base="ne")
+        if not text:
+            text = "匠心鞋面,质感出众,型格自现"
+        _pp = PictureProcessing().get_text_image_advanced(
+            font=font_1,
+            text=text,
+            fill=(122, 122, 122),
+            return_mode="min_image",
+        )
+        pp_bg_2 = pp_bg_2.paste_img(top_img=_pp, value=(143, 166), base="ne")
         detailed_images.append(pp_bg_2)
 
-        pp_jpg = self.get_overlay_pic_from_dict(goods_art_no=goods_art_no_list[0],
-                                                color_name="俯视",
-                                                bg_color=self.base_bg_color)
+        pp_jpg = self.get_overlay_pic_from_dict(
+            goods_art_no=goods_art_no_list[0],
+            color_name="俯视",
+            bg_color=self.base_bg_color,
+        )
         pp_jpg = pp_jpg.transpose(mode="left_right")
         pp_jpg = pp_jpg.resize(value=2210)
         pp_jpg = pp_jpg.paste_img_invert(
-            top_img=PictureProcessing("RGB", (1600, pp_jpg.height + 200), self.base_bg_color),
+            top_img=PictureProcessing(
+                "RGB", (1600, pp_jpg.height + 200), self.base_bg_color
+            ),
             base="en",
-            value=(149, 0)
+            value=(149, 0),
         )
         detailed_images.append(pp_jpg)
         # =====添加内里图
         pp_bg_3 = PictureProcessing(r"{}\8.jpg".format(self.root))
         text = self.get_text_value("提示2主标题")
-        if text:
-            _pp = PictureProcessing().get_text_image_advanced(
-                font=font_1,
-                text=text,
-                fill=(122, 122, 122),
-                return_mode="min_image",
-            )
-            pp_bg_3 = pp_bg_3.paste_img(top_img=_pp, value=(143, 166), base="nw")
+        if not text:
+            text = "透气鞋面配皮内里,干爽舒适一整天"
+        _pp = PictureProcessing().get_text_image_advanced(
+            font=font_1,
+            text=text,
+            fill=(122, 122, 122),
+            return_mode="min_image",
+        )
+        pp_bg_3 = pp_bg_3.paste_img(top_img=_pp, value=(143, 166), base="nw")
         detailed_images.append(pp_bg_3)
 
-        pp_jpg = self.get_overlay_pic_from_dict(goods_art_no=goods_art_no_list[0],
-                                                color_name="内里",
-                                                bg_color=self.base_bg_color)
+        pp_jpg = self.get_overlay_pic_from_dict(
+            goods_art_no=goods_art_no_list[0],
+            color_name="内里",
+            bg_color=self.base_bg_color,
+        )
         pp_jpg = pp_jpg.resize(value=2130)
         pp_jpg = pp_jpg.paste_img_invert(
-            top_img=PictureProcessing("RGB", (1600, pp_jpg.height + 100), self.base_bg_color),
+            top_img=PictureProcessing(
+                "RGB", (1600, pp_jpg.height + 100), self.base_bg_color
+            ),
             base="wc",
-            value=(294, 0)
+            value=(294, 0),
         )
         detailed_images.append(pp_jpg)
 
         return PictureProcessing(im=self.add_pic(detailed_images))
 
-
-    #模特图
+    # 模特图
     def deal_pic_3_2(self):
         if self.get_text_value("模特图"):
             mote_img = PictureProcessing(self.get_text_value("模特图"))
             mote_img = mote_img.resize(value=1600)
-            bg_img = PictureProcessing("RGB", (mote_img.width, mote_img.height), (255,255,255))
-            bg_img = bg_img.paste_img(top_img=mote_img,base="nc", value=(0, 0))
+            bg_img = PictureProcessing(
+                "RGB", (mote_img.width, mote_img.height), (255, 255, 255)
+            )
+            bg_img = bg_img.paste_img(top_img=mote_img, base="nc", value=(0, 0))
             return bg_img
         else:
             return
-    #场景图
+
+    # 场景图
     def deal_pic_3_3(self):
         if self.get_text_value("场景图"):
             mote_img = PictureProcessing(self.get_text_value("场景图"))
             mote_img = mote_img.resize(value=1600)
-            bg_img = PictureProcessing("RGB", (mote_img.width, mote_img.height), (255,255,255))
-            bg_img = bg_img.paste_img(top_img=mote_img,base="nc", value=(0, 0))
+            bg_img = PictureProcessing(
+                "RGB", (mote_img.width, mote_img.height), (255, 255, 255)
+            )
+            bg_img = bg_img.paste_img(top_img=mote_img, base="nc", value=(0, 0))
             return bg_img
         else:
             return
 
-
     # 展示产品信息和颜色图
     def deal_pic_4(self):
         detailed_images = []
@@ -194,23 +238,50 @@ class DetailPicGet(DetailBase):
         #  添加基础信息
         font_1 = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 46)  # 颜色名称
         text_list = [
-            {"text": "产品名称", "pos": (294, 531)},
-            {"text": "产地", "pos": (1235, 531)},
-            {"text": "鞋面材质", "pos": (429, 623)},
-            {"text": "鞋底材质", "pos": (1235, 623)},
-            {"text": "设计理念", "pos": (294, 721)},
+            {
+                "text": "产品名称",
+                "temp_text": "商品标题",
+                "default_value": "",
+                "pos": (294, 531),
+            },
+            {"text": "产地", "temp_text": "", "default_value": "浙江温州", "pos": (1235, 531)},
+            {
+                "text": "鞋面材质",
+                "temp_text": "商品面料",
+                "default_value": "",
+                "pos": (429, 623),
+            },
+            {
+                "text": "鞋底材质",
+                "temp_text": "商品鞋底",
+                "default_value": "",
+                "pos": (1235, 623),
+            },
+            {
+                "text": "设计理念",
+                "temp_text": "",
+                "default_value": "",
+                "pos": (294, 721),
+            },
         ]
         pp_bg_1 = PictureProcessing(r"{}\9.jpg".format(self.root))
         for text_data in text_list:
             text = self.get_text_value(text_data["text"])
-            if text:
-                _pp = PictureProcessing().get_text_image_advanced(
-                    font=font_1,
-                    text=text,
-                    fill=(136, 136, 136),
-                    return_mode="min_image",
-                )
-                pp_bg_1 = pp_bg_1.paste_img(top_img=_pp, value=text_data["pos"])
+            if not text:
+                if text_data["temp_text"]:
+                    text = self.get_text_value(text_data["temp_text"])
+                if not text:
+                    text = text_data["default_value"]
+                if not text:
+                    continue
+            text = text[:13].join("...") if len(text) > 15 else text
+            _pp = PictureProcessing().get_text_image_advanced(
+                font=font_1,
+                text=text,
+                fill=(136, 136, 136),
+                return_mode="min_image",
+            )
+            pp_bg_1 = pp_bg_1.paste_img(top_img=_pp, value=text_data["pos"])
 
         detailed_images.append(pp_bg_1)
         # =======添加各个颜色====多余高度需要剪裁
@@ -221,32 +292,41 @@ class DetailPicGet(DetailBase):
         for goods_art_no_dict in self.goods_no_value["货号资料"]:
             color_name = goods_art_no_dict["颜色名称"]
             goods_art_no = goods_art_no_dict["货号"]
-            pp_jpg = self.get_overlay_pic_from_dict(goods_art_no=goods_art_no,
-                                                    color_name="侧视",
-                                                    bg_color=self.base_bg_color)
+            pp_jpg = self.get_overlay_pic_from_dict(
+                goods_art_no=goods_art_no,
+                color_name="侧视",
+                bg_color=self.base_bg_color,
+            )
             pp_jpg = pp_jpg.resize(value=390)
 
             pp_jpg = pp_jpg.paste_img_invert(
-                top_img=PictureProcessing("RGBA", (pp_jpg.width, pp_jpg.height + 70), (255, 255, 255, 0)),
-                base="nw"
+                top_img=PictureProcessing(
+                    "RGBA", (pp_jpg.width, pp_jpg.height + 70), (255, 255, 255, 0)
+                ),
+                base="nw",
+            )
+            text_image = pp_bg_2.get_text_image_advanced(
+                font=font_2,
+                text="{} / COLOR".format(color_name),
+                fill=(0, 0, 0),
+                return_mode="min_image",
             )
-            text_image = pp_bg_2.get_text_image_advanced(font=font_2,
-                                                         text="{} / COLOR".format(color_name),
-                                                         fill=(0, 0, 0),
-                                                         return_mode="min_image")
 
             pp_jpg = pp_jpg.paste_img(top_img=text_image, base="sc", value=(0, 10))
             color_pic_list_1.append(pp_jpg)
 
         # 颜色列表进行等分展示
-        all_color_pp = PictureProcessing().horizontal_distribution(color_pic_list_1, bg_width=1114,
-                                                                   line_spacing=10,
-                                                                   number_per_row=2)
+        all_color_pp = PictureProcessing().horizontal_distribution(
+            color_pic_list_1, bg_width=1114, line_spacing=10, number_per_row=2
+        )
 
         all_color_pp = all_color_pp.paste_img_invert(
-            top_img=PictureProcessing("RGB", (1600, all_color_pp.height + 100), self.base_bg_color),
+            top_img=PictureProcessing(
+                "RGB", (1600, all_color_pp.height + 100), self.base_bg_color
+            ),
             base="cc",
-            value=(0, 0))
+            value=(0, 0),
+        )
         detailed_images.append(all_color_pp)
         return PictureProcessing(im=self.add_pic(detailed_images))
 
@@ -262,17 +342,22 @@ class DetailPicGet(DetailBase):
             color_name = goods_art_no_dict["颜色名称"]
             goods_art_no = goods_art_no_dict["货号"]
             for index, view_name in enumerate(view_list):
-                pp_jpg = self.get_overlay_pic_from_dict(goods_art_no=goods_art_no,
-                                                        color_name=view_name,
-                                                        bg_color=self.base_bg_color)
+                pp_jpg = self.get_overlay_pic_from_dict(
+                    goods_art_no=goods_art_no,
+                    color_name=view_name,
+                    bg_color=self.base_bg_color,
+                )
                 if view_name == "后跟":
                     pp_jpg = pp_jpg.resize(value=600)
                 else:
                     pp_jpg = pp_jpg.resize(value=1202)
                 pp_jpg = pp_jpg.paste_img_invert(
-                    top_img=PictureProcessing("RGB", (1600, pp_jpg.height + 100), self.base_bg_color),
+                    top_img=PictureProcessing(
+                        "RGB", (1600, pp_jpg.height + 100), self.base_bg_color
+                    ),
                     base="cc",
-                    value=(0, 0))
+                    value=(0, 0),
+                )
                 detailed_images.append(pp_jpg)
 
         return PictureProcessing(im=self.add_pic(detailed_images))

+ 41 - 24
python/custom_plugins/plugins/detail_template/huilima/detail_huilima3.py

@@ -147,14 +147,18 @@ class DetailPicGet(DetailBase):
         pp_bg_2 = PictureProcessing(r"{}\3.jpg".format(self.root))
         font_1 = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 60)  # 颜色名称
         text = self.get_text_value("标题")
-        if text:
-            _pp = PictureProcessing().get_text_image_advanced(
-                font=font_1,
-                text=text,
-                fill=(255, 255, 255),
-                return_mode="min_image",
-            )
-            pp_bg_2 = pp_bg_2.paste_img(top_img=_pp, value=(0, 362), base="nc")
+        if not text:
+            text = self.get_text_value("商品标题")
+            text = text[:6] if len(text) > 6 else text
+        if not text:
+            text = "复古运动鞋"
+        _pp = PictureProcessing().get_text_image_advanced(
+            font=font_1,
+            text=text,
+            fill=(255, 255, 255),
+            return_mode="min_image",
+        )
+        pp_bg_2 = pp_bg_2.paste_img(top_img=_pp, value=(0, 362), base="nc")
         detailed_images.append(pp_bg_2)
 
         return PictureProcessing(im=self.add_pic(detailed_images))
@@ -179,26 +183,38 @@ class DetailPicGet(DetailBase):
         # 介绍卖点
         font_1 = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 60)  # 颜色名称
         text_list = [
-            {"text": "卖点1标题", "pos": (0, 58)},
-            {"text": "卖点2标题", "pos": (0, 283)},
-            {"text": "卖点3标题", "pos": (0, 505)},
+            {
+                "text": "卖点1标题",
+                "default": "轻盈缓震,健步如飞,久走不累",
+                "pos": (0, 58),
+            },
+            {
+                "text": "卖点2标题",
+                "default": "透气网面,干爽舒适,告别闷热",
+                "pos": (0, 283),
+            },
+            {
+                "text": "卖点3标题",
+                "default": "柔韧大底,灵活弯折,自在穿行",
+                "pos": (0, 505),
+            },
         ]
         pp_bg_2 = PictureProcessing(r"{}\6.jpg".format(self.root))
         for text_data in text_list:
             text = self.get_text_value(text_data["text"])
-            if text:
-                _pp = PictureProcessing().get_text_image_advanced(
-                    font=font_1,
-                    text=text,
-                    fill=(0, 0, 0),
-                    return_mode="min_image",
-                )
-                pp_bg_2 = pp_bg_2.paste_img(top_img=_pp, value=text_data["pos"], base="nc")
+            if not text:
+                text = text_data["default"]
+            _pp = PictureProcessing().get_text_image_advanced(
+                font=font_1,
+                text=text,
+                fill=(0, 0, 0),
+                return_mode="min_image",
+            )
+            pp_bg_2 = pp_bg_2.paste_img(top_img=_pp, value=text_data["pos"], base="nc")
         detailed_images.append(pp_bg_2)
         return PictureProcessing(im=self.add_pic(detailed_images))
 
-
-    #模特图
+    # 模特图
     def deal_pic_2_2(self):
         if self.get_text_value("模特图"):
             mote_img = PictureProcessing(self.get_text_value("模特图"))
@@ -208,7 +224,7 @@ class DetailPicGet(DetailBase):
             return bg_img
         else:
             return
-    #场景图
+    # 场景图
     def deal_pic_2_3(self):
         if self.get_text_value("场景图"):
             mote_img = PictureProcessing(self.get_text_value("场景图"))
@@ -219,8 +235,6 @@ class DetailPicGet(DetailBase):
         else:
             return
 
-
-
     # 细节展示
     def deal_pic_3(self):
         detailed_images = []
@@ -334,6 +348,9 @@ class DetailPicGet(DetailBase):
                 if view_name == "后跟":
                     pp_jpg = pp_jpg.resize(value=500)
                     pp_png = pp_png.resize(value=500)
+                    if pp_jpg.height > 382:
+                        pp_png = pp_png.resize(value=330, base="high")
+                        pp_jpg = pp_jpg.resize(value=330, base="high")
                     pp_jpg, pp_png = self.copy_view(pp_jpg, pp_png)
                     resize_value = 469
                     value = (1243, 681)

+ 47 - 27
python/custom_plugins/plugins/detail_template/huilima/detail_huilima4.py

@@ -80,19 +80,24 @@ class DetailPicGet(DetailBase):
         pp_bg_1 = PictureProcessing(r"{}\1.jpg".format(self.root))
         font_1 = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 120)
         text_list = [
-            {"text": "标题", "pos": (89, 224)},
-            {"text": "副标题", "pos": (89, 345)},
+            {
+                "text": "标题",
+                "default": self.get_text_value("商品标题"),
+                "pos": (89, 224),
+            },
+            {"text": "副标题", "default": "百搭舒适,型走随心", "pos": (89, 345)},
         ]
         for text_data in text_list:
             text = self.get_text_value(text_data["text"])
             if text:
-                _pp = PictureProcessing().get_text_image_advanced(
-                    font=font_1,
-                    text=text,
-                    fill=(0, 0, 0),
-                    return_mode="min_image",
-                )
-                pp_bg_1 = pp_bg_1.paste_img(top_img=_pp, value=text_data["pos"], base="nw")
+                text = text_data["default"]
+            _pp = PictureProcessing().get_text_image_advanced(
+                font=font_1,
+                text=text,
+                fill=(0, 0, 0),
+                return_mode="min_image",
+            )
+            pp_bg_1 = pp_bg_1.paste_img(top_img=_pp, value=text_data["pos"], base="nw")
         detailed_images.append(pp_bg_1)
 
         # 粘贴组合图
@@ -135,23 +140,40 @@ class DetailPicGet(DetailBase):
         pp_bg_2 = PictureProcessing(r"{}\5.jpg".format(self.root))
         font_1 = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 62)
         text_list = [
-            {"text": "鞋面材质", "pos": (767, 176)},
-            {"text": "内里材质", "pos": (1213, 176)},
-            {"text": "鞋底材质", "pos": (767, 345)},
-            {"text": "鞋垫材质", "pos": (1213, 345)},
-            {"text": "跟高", "pos": (767, 616)},
-            {"text": "前底厚度", "pos": (1196, 616)},
+            {
+                "text": "鞋面材质",
+                "default": self.get_text_value("商品面料"),
+                "pos": (767, 176),
+            },
+            {
+                "text": "内里材质",
+                "default": self.get_text_value("商品内里"),
+                "pos": (1213, 176),
+            },
+            {
+                "text": "鞋底材质",
+                "default": self.get_text_value("商品鞋底"),
+                "pos": (767, 345),
+            },
+            {
+                "text": "鞋垫材质",
+                "default": self.get_text_value("鞋垫"),
+                "pos": (1213, 345),
+            },
+            {"text": "跟高", "default": "6CM", "pos": (767, 616)},
+            {"text": "前底厚度", "default": "3CM", "pos": (1196, 616)},
         ]
         for text_data in text_list:
             text = self.get_text_value(text_data["text"])
-            if text:
-                _pp = PictureProcessing().get_text_image_advanced(
-                    font=font_1,
-                    text=text,
-                    fill=(0, 0, 0),
-                    return_mode="min_image",
-                )
-                pp_bg_2 = pp_bg_2.paste_img(top_img=_pp, value=text_data["pos"], base="nw")
+            if not text:
+                text = text_data["default"]
+            _pp = PictureProcessing().get_text_image_advanced(
+                font=font_1,
+                text=text,
+                fill=(0, 0, 0),
+                return_mode="min_image",
+            )
+            pp_bg_2 = pp_bg_2.paste_img(top_img=_pp, value=text_data["pos"], base="nw")
         detailed_images.append(pp_bg_2)
 
         return PictureProcessing(im=self.add_pic(detailed_images))
@@ -192,8 +214,7 @@ class DetailPicGet(DetailBase):
         detailed_images.append(all_color_pp)
         return PictureProcessing(im=self.add_pic(detailed_images))
 
-
-    #模特图
+    # 模特图
     def deal_pic_3_2(self):
         if self.get_text_value("模特图"):
             mote_img = PictureProcessing(self.get_text_value("模特图"))
@@ -203,7 +224,7 @@ class DetailPicGet(DetailBase):
             return bg_img
         else:
             return
-    #场景图
+    # 场景图
     def deal_pic_3_3(self):
         if self.get_text_value("场景图"):
             mote_img = PictureProcessing(self.get_text_value("场景图"))
@@ -214,7 +235,6 @@ class DetailPicGet(DetailBase):
         else:
             return
 
-
     # 展示细节图
     def deal_pic_4(self):
         detailed_images = []

+ 75 - 36
python/custom_plugins/plugins/detail_template/huilima/detail_huilima5.py

@@ -109,6 +109,8 @@ class DetailPicGet(DetailBase):
         font_sub = ImageFont.truetype(r"resources\ttf\puhui\Medium.ttf", 50)
         main_text = self.get_text_value("标题")
         sub_text = self.get_text_value("副标题")
+        if not main_text:
+            main_text = "复古勃肯"
         _pp = PictureProcessing().get_text_image_advanced(
             font=font_main,
             text=main_text,
@@ -116,6 +118,8 @@ class DetailPicGet(DetailBase):
             spacing=20,
             return_mode="min_image",
         )
+        if not sub_text:
+            sub_text = "百搭|舒适|柔软|耐穿|复古|高级"
         _pp_sub = PictureProcessing().get_text_image_advanced(
             font=font_sub,
             text=sub_text,
@@ -176,6 +180,10 @@ class DetailPicGet(DetailBase):
         font_desc = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 48)
         text = self.get_text_value("设计理念-标题")
         text_desc = self.get_text_value("设计理念")
+        if not text:
+            text = "让勃肯鞋陪你CITY一下"
+        if not text_desc:
+            text_desc = "以独特得复古风格,让你在繁华都市中独树一帜\n独特得软木颗粒中底设计,提供出色得缓效果\n轻松打造出慵懒而不失格调的复古风\n后跟部分可灵活调整,让你在不同场合都能找到\n最舒适得穿着方式"
         _pp = PictureProcessing().get_text_image_advanced(
             font=font_1,
             text=text,
@@ -239,37 +247,53 @@ class DetailPicGet(DetailBase):
         pp_bg.paste_img(top_img=all_color_pp, base="cc", value=(0, -100))
         font_category = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 50)
         text_xiemian = self.get_text_value("鞋面")
+        if not text_xiemian:
+            text_xiemian = self.get_text_value("商品面料")
         text_xiedi = self.get_text_value("鞋底")
+        if not text_xiedi:
+            text_xiedi = self.get_text_value("商品鞋底")
         text_neili = self.get_text_value("内里")
+        if not text_neili:
+            text_neili = self.get_text_value("商品内里")
         text_xiedian = self.get_text_value("鞋垫")
-        pp_text_xiemian = PictureProcessing().get_text_image_advanced(
-            font=font_category,
-            text=text_xiemian,
-            fill=(0, 0, 0),
-            return_mode="min_image",
-        )
-        pp_text_xiedian = PictureProcessing().get_text_image_advanced(
-            font=font_category,
-            text=text_xiedian,
-            fill=(0, 0, 0),
-            return_mode="min_image",
-        )
-        pp_text_xiedi = PictureProcessing().get_text_image_advanced(
-            font=font_category,
-            text=text_xiedi,
-            fill=(0, 0, 0),
-            return_mode="min_image",
-        )
-        pp_text_neili = PictureProcessing().get_text_image_advanced(
-            font=font_category,
-            text=text_neili,
-            fill=(0, 0, 0),
-            return_mode="min_image",
-        )
-        pp_bg = pp_bg.paste_img(top_img=pp_text_xiemian, value=(416, 960), base="nw")
-        pp_bg = pp_bg.paste_img(top_img=pp_text_xiedian, value=(416, 1144), base="nw")
-        pp_bg = pp_bg.paste_img(top_img=pp_text_neili, value=(1157, 960), base="nw")
-        pp_bg = pp_bg.paste_img(top_img=pp_text_xiedi, value=(1157, 1144), base="nw")
+        if text_xiemian:
+            pp_text_xiemian = PictureProcessing().get_text_image_advanced(
+                font=font_category,
+                text=text_xiemian,
+                fill=(0, 0, 0),
+                return_mode="min_image",
+            )
+            pp_bg = pp_bg.paste_img(
+                top_img=pp_text_xiemian, value=(416, 960), base="nw"
+            )
+        if text_xiedian:
+            pp_text_xiedian = PictureProcessing().get_text_image_advanced(
+                font=font_category,
+                text=text_xiedian,
+                fill=(0, 0, 0),
+                return_mode="min_image",
+            )
+            pp_bg = pp_bg.paste_img(
+                top_img=pp_text_xiedian, value=(416, 1144), base="nw"
+            )
+        if text_xiedi:
+            pp_text_xiedi = PictureProcessing().get_text_image_advanced(
+                font=font_category,
+                text=text_xiedi,
+                fill=(0, 0, 0),
+                return_mode="min_image",
+            )
+            pp_bg = pp_bg.paste_img(
+                top_img=pp_text_xiedi, value=(1157, 1144), base="nw"
+            )
+        if text_neili:
+            pp_text_neili = PictureProcessing().get_text_image_advanced(
+                font=font_category,
+                text=text_neili,
+                fill=(0, 0, 0),
+                return_mode="min_image",
+            )
+            pp_bg = pp_bg.paste_img(top_img=pp_text_neili, value=(1157, 960), base="nw")
         detailed_images.append(pp_bg)
         return PictureProcessing(im=self.add_pic(detailed_images))
 
@@ -281,7 +305,11 @@ class DetailPicGet(DetailBase):
         font_title = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 150)
         font_sub = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 50)
         text_title = self.get_text_value("细节标题-1")
+        if not text_title:
+            text_title = "可调节饰扣"
         text_sub_title = self.get_text_value("细节副标题-1")
+        if not text_sub_title:
+            text_sub_title = "三孔调节饰扣,搭配不同脚型"
         pp_text_title = PictureProcessing().get_text_image_advanced(
             font=font_title,
             text=text_title,
@@ -317,7 +345,11 @@ class DetailPicGet(DetailBase):
         font_title = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 150)
         font_sub = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 50)
         text_title = self.get_text_value("细节标题-2")
+        if not text_title:
+            text_title = "细腻反绒鞋面"
         text_sub_title = self.get_text_value("细节副标题-2")
+        if not text_sub_title:
+            text_sub_title = "鞋面采用触感舒适得牛反绒\n彰显复古慵懒属性\n轻松驾驭不同穿搭"
         pp_text_title = PictureProcessing().get_text_image_advanced(
             font=font_title,
             text=text_title,
@@ -353,7 +385,11 @@ class DetailPicGet(DetailBase):
         font_title = ImageFont.truetype(r"resources\ttf\puhui\Bold.ttf", 150)
         font_sub = ImageFont.truetype(r"resources\ttf\puhui\Regular.ttf", 50)
         text_title = self.get_text_value("细节标题-3")
+        if not text_title:
+            text_title = "后跟下踩设计"
         text_sub_title = self.get_text_value("细节副标题-3")
+        if not text_sub_title:
+            text_sub_title = "单鞋&拖鞋 随时切换"
         pp_text_title = PictureProcessing().get_text_image_advanced(
             font=font_title,
             text=text_title,
@@ -381,29 +417,32 @@ class DetailPicGet(DetailBase):
 
         return PictureProcessing(im=self.add_pic(detailed_images))
 
-
-    #模特图
+    # 模特图
     def deal_pic_6_2(self):
         if self.get_text_value("模特图"):
             mote_img = PictureProcessing(self.get_text_value("模特图"))
             mote_img = mote_img.resize(value=1600)
-            bg_img = PictureProcessing("RGB", (mote_img.width, mote_img.height), (255,255,255))
-            bg_img = bg_img.paste_img(top_img=mote_img,base="nc", value=(0, 0))
+            bg_img = PictureProcessing(
+                "RGB", (mote_img.width, mote_img.height), (255, 255, 255)
+            )
+            bg_img = bg_img.paste_img(top_img=mote_img, base="nc", value=(0, 0))
             return bg_img
         else:
             return
-    #场景图
+
+    # 场景图
     def deal_pic_6_3(self):
         if self.get_text_value("场景图"):
             mote_img = PictureProcessing(self.get_text_value("场景图"))
             mote_img = mote_img.resize(value=1600)
-            bg_img = PictureProcessing("RGB", (mote_img.width, mote_img.height), (255,255,255))
-            bg_img = bg_img.paste_img(top_img=mote_img,base="nc", value=(0, 0))
+            bg_img = PictureProcessing(
+                "RGB", (mote_img.width, mote_img.height), (255, 255, 255)
+            )
+            bg_img = bg_img.paste_img(top_img=mote_img, base="nc", value=(0, 0))
             return bg_img
         else:
             return
 
-
     # 场景图--产品展示
     def deal_pic_7(self):
         detailed_images = []