diff --git a/backend/auth/apps/settings/urls.py b/backend/auth/apps/settings/urls.py index f2385c8..2ccab61 100644 --- a/backend/auth/apps/settings/urls.py +++ b/backend/auth/apps/settings/urls.py @@ -73,18 +73,21 @@ async def get_public_setting( key: str = None, db: AsyncSession = Depends(get_db), ): - """公开接口:获取系统设置(仅允许获取id为1或key为"系统标题"的内容)""" + """公开接口:获取系统设置(允许获取id为1/2或key为"系统标题"/"IPC内容"的内容)""" + ALLOWED_IDS = {1, 2, 3} + ALLOWED_KEYS = {"系统标题", "页脚信息", "IPC信息"} + if setting_id is not None: - if setting_id != 1: + if setting_id not in ALLOWED_IDS: raise HTTPException(status_code=403, detail="无权访问该设置项") result = await db.execute(select(SystemSetting).filter(SystemSetting.id == setting_id)) elif key is not None: - if key != "系统标题": + if key not in ALLOWED_KEYS: raise HTTPException(status_code=403, detail="无权访问该设置项") result = await db.execute(select(SystemSetting).filter(SystemSetting.key == key)) else: raise HTTPException(status_code=400, detail="必须提供setting_id或key参数") - + setting = result.scalar_one_or_none() if not setting: raise HTTPException(status_code=404, detail="设置项不存在") diff --git a/backend/auth/init_data.py b/backend/auth/init_data.py index e29ac0c..d5e648b 100644 --- a/backend/auth/init_data.py +++ b/backend/auth/init_data.py @@ -349,6 +349,18 @@ async def init_system_settings(db: AsyncSession): "type": "string", "description": "系统显示标题" }, + { + "key": "页脚信息", + "value": "© 2026 图书管理系统 版权所有 | 技术支持:强蕊科技", + "type": "string", + "description": "页脚信息" + }, + { + "key": "ICP信息", + "value": "京ICP备2023000000号", + "type": "string", + "description": "ICP备案信息" + } ] # 检查现有系统设置 diff --git a/frontend/src/modules/admin/layout/AdminLayout.vue b/frontend/src/modules/admin/layout/AdminLayout.vue index 0bdab64..5d151bb 100644 --- a/frontend/src/modules/admin/layout/AdminLayout.vue +++ b/frontend/src/modules/admin/layout/AdminLayout.vue @@ -53,6 +53,13 @@