feat: v0.8.x 功能更新与数据维护优化
- MAC地址格式统一为小写 xxxx-xxxx-xxxx,支持三种格式输入 - 更换设备MAC时自动清理OLT新发现列表中的冲突ONU记录 - 设备编辑新增场所类型字段(手动输入),区域改为下拉快速填充 - 编辑/更换设备时自动移除new_devices中同MAC的待入库记录 - 新增登录过期自动跳转(401拦截 + 过期提示) - 新增关于页面(/about),支持Markdown渲染,管理员可在设置中编辑内容 - 新增device_status_history每日自动清理任务(保留30天) - 更新README.md和about.md
This commit is contained in:
@@ -74,3 +74,27 @@ def update_check_interval(
|
||||
_get_redis().delete("check_all_devices:last_run")
|
||||
|
||||
return {"key": "check_interval_seconds", "value": seconds}
|
||||
|
||||
|
||||
@router.get("/about")
|
||||
def get_about(db: Session = Depends(get_db)):
|
||||
"""获取关于页面内容(公开接口,无需登录)"""
|
||||
setting = db.query(SystemSetting).filter_by(key='about_content').first()
|
||||
return {"content": setting.value if setting else ""}
|
||||
|
||||
|
||||
@router.put("/about")
|
||||
def update_about(
|
||||
body: dict,
|
||||
db: Session = Depends(get_db),
|
||||
_: dict = Depends(require_permission('*')),
|
||||
):
|
||||
"""更新关于页面内容(仅管理员)"""
|
||||
content = body.get("content", "")
|
||||
setting = db.query(SystemSetting).filter_by(key='about_content').first()
|
||||
if setting:
|
||||
setting.value = content
|
||||
else:
|
||||
db.add(SystemSetting(key='about_content', value=content, description='关于页面内容(Markdown)'))
|
||||
db.commit()
|
||||
return {"key": "about_content", "value": content}
|
||||
|
||||
Reference in New Issue
Block a user