From f441614f477f26ccf65bfe87ec42e0ce03f514dc Mon Sep 17 00:00:00 2001 From: Pine Date: Sun, 13 Sep 2026 23:43:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=BF=E7=AD=96=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0content=5Fhtml=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 详情接口返回的正文字段是body,前端期望content_html。 在_resolve_content_media后添加content_html = body映射,确保前端能正确渲染正文。 --- app/api/routers/rbac_opc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/api/routers/rbac_opc.py b/app/api/routers/rbac_opc.py index ff90c69..099dfe7 100644 --- a/app/api/routers/rbac_opc.py +++ b/app/api/routers/rbac_opc.py @@ -158,6 +158,8 @@ async def opc_content_detail( await db.content.incr_read_count(content_id) item["read_count"] = (item.get("read_count") or 0) + 1 item = _resolve_content_media(item) + # 正文字段统一为 content_html(兼容前端) + item["content_html"] = item.get("body", "") # 当前登录用户是否已点赞(未登录 false) item["liked_by_me"] = await db.content.is_liked(content_id, (user or {}).get("id", "")) return item