From d80550cb3664f36cfafda925fa4ccbba169f2f74 Mon Sep 17 00:00:00 2001 From: Pine Date: Sun, 13 Sep 2026 23:16:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=BF=E7=AD=96=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0public=5Fonly=E8=BF=87=E6=BB=A4=EF=BC=8C?= =?UTF-8?q?=E4=B8=8E=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3=E4=BF=9D=E6=8C=81?= =?UTF-8?q?=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: 政策列表接口未传public_only=True,返回了is_public=false的政策; 详情接口要求is_public=True,导致点击政策详情返回404'政策不存在或已下架'。 修复: /opc/policy 接口增加public_only=True,并对媒体字段调用_resolve_content_media --- app/api/routers/rbac_opc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/api/routers/rbac_opc.py b/app/api/routers/rbac_opc.py index da9c8f4..d7d0192 100644 --- a/app/api/routers/rbac_opc.py +++ b/app/api/routers/rbac_opc.py @@ -118,7 +118,8 @@ async def opc_policy( db: Database = Depends(get_db), _u: dict = Depends(require_roles("opc_member")), ): - return {"items": await db.content.list(ctype="policy", status="published", scheduled_ready=True)} + items = await db.content.list(ctype="policy", status="published", public_only=True, scheduled_ready=True) + return {"items": [_resolve_content_media(it) for it in items]} def _resolve_content_media(item: dict) -> dict: