mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-07 04:40:00 +08:00
🐛 移除resources,图标不存在时不会显示图片 (#1820)
Co-authored-by: Flern <cb56ec362bbbfb5272eb941281299d8d-qq_connect@git.osc>
This commit is contained in:
@@ -33,10 +33,10 @@ async def html_image() -> bytes:
|
||||
partition_dict[goods[1].partition] = []
|
||||
icon = None
|
||||
if goods[1].icon:
|
||||
icon = (
|
||||
"data:image/png;base64,"
|
||||
+ BuildImage.open(ICON_PATH / goods[1].icon).pic2bs4()[9:]
|
||||
)
|
||||
path = ICON_PATH / goods[1].icon
|
||||
if path.exists():
|
||||
icon = "data:image/png;base64,"
|
||||
f"{BuildImage.open(ICON_PATH / goods[1].icon).pic2bs4()[9:]}"
|
||||
partition_dict[goods[1].partition].append(
|
||||
{
|
||||
"id": goods[0],
|
||||
@@ -47,15 +47,10 @@ async def html_image() -> bytes:
|
||||
"description": goods[1].goods_description,
|
||||
}
|
||||
)
|
||||
data_list = []
|
||||
for partition in partition_dict:
|
||||
data_list.append(
|
||||
GoodsItem(
|
||||
goods_list=partition_dict[partition],
|
||||
partition=partition,
|
||||
)
|
||||
)
|
||||
|
||||
data_list = [
|
||||
GoodsItem(goods_list=value, partition=partition)
|
||||
for partition, value in partition_dict.items()
|
||||
]
|
||||
return await template_to_pic(
|
||||
template_path=str((TEMPLATE_PATH / "shop").absolute()),
|
||||
template_name="main.html",
|
||||
|
||||
Reference in New Issue
Block a user