update:1.修复1-n模式下点击保存章节内容导致章节对应大纲999的问题 2.优化项目主页头部统计数据UI样式

This commit is contained in:
xiamuceer
2025-12-20 15:35:55 +08:00
parent ca6165cb64
commit 6886d903fe
4 changed files with 51 additions and 20 deletions
+30 -1
View File
@@ -356,7 +356,36 @@ async def update_chapter(
await db.commit()
await db.refresh(chapter)
return chapter
chapter_dict = {
"id": chapter.id,
"project_id": chapter.project_id,
"chapter_number": chapter.chapter_number,
"title": chapter.title,
"content": chapter.content,
"summary": chapter.summary,
"word_count": chapter.word_count,
"status": chapter.status,
"outline_id": chapter.outline_id,
"sub_index": chapter.sub_index,
"expansion_plan": chapter.expansion_plan,
"created_at": chapter.created_at,
"updated_at": chapter.updated_at,
"outline_title": None,
"outline_order": None
}
# 如果章节关联了大纲,查询大纲信息
if chapter.outline_id:
outline_result = await db.execute(
select(Outline).where(Outline.id == chapter.outline_id)
)
outline = outline_result.scalar_one_or_none()
if outline:
chapter_dict["outline_title"] = outline.title
chapter_dict["outline_order"] = outline.order_index
return chapter_dict
@router.delete("/{chapter_id}", summary="删除章节")