This commit is contained in:
2026-06-26 10:06:17 +08:00
parent cee7093db6
commit 509892ca7b
3 changed files with 386 additions and 529 deletions
+17 -2
View File
@@ -400,12 +400,27 @@ async def _seed_data():
("/generated", "素材云", "CloudOutlined", 1, "资产管理", True),
("/authorization", "授权管理", "UserOutlined", 0, "媒体关联", False),
("/consume", "消耗列表", "FileTextOutlined", 1, "媒体关联", False),
("/popular", "热门广场", "ThunderboltOutlined", 0, "AI项目行业生成", False),
("/creativeplaza", "创意广场", "GiftOutlined", 0, "AI对话生成", False),
]
for path, label, icon, order, group_label, is_default in frontend_pages:
existing = await db.execute(
select(MenuConfig).where(MenuConfig.path == path).limit(1)
select(MenuConfig).where(
MenuConfig.path == path,
MenuConfig.menu_target == "frontend",
).limit(1)
)
if not existing.scalar_one_or_none():
existing_page = existing.scalar_one_or_none()
if existing_page:
# Update existing menu item if needed
if existing_page.label != label or existing_page.icon != icon or \
existing_page.sort_order != order or existing_page.is_default != is_default:
existing_page.label = label
existing_page.icon = icon
existing_page.sort_order = order
existing_page.is_default = is_default
existing_page.parent_id = frontend_group_ids.get(group_label)
else:
db.add(
MenuConfig(
id=generate_id(),