feat: v0.9.0 新增记录日志、设备更换记录及IMC服务集成
- 新增 RecordsLog.vue 操作记录日志页面 - 新增 ReplacementRecords.vue 设备更换记录页面 - 新增 imc_service.py IMC网管系统集成服务 - 新增 datetime.js 前端日期时间工具函数 - 新增 OLT时间同步.md 文档 - 扩展 devices.py API:设备更换记录、批量操作等 - 扩展 ssh_service.py:OLT时间同步功能 - 扩展 olt.py:新增时间同步相关接口 - 更新 DeviceList.vue:增强设备列表功能 - 更新路由和导航菜单 - 将 .claude/ 和 .mcp.json 加入 .gitignore Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
"""审计日志 API"""
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Optional
|
||||
from fastapi import APIRouter, Depends, Query
|
||||
from fastapi.responses import StreamingResponse
|
||||
@@ -113,8 +113,9 @@ def export_audit_logs(
|
||||
writer = csv.writer(buf)
|
||||
writer.writerow(["时间", "用户", "角色", "操作类型", "子类型", "路径", "状态码", "状态", "IP", "描述"])
|
||||
for r in items:
|
||||
t_cst = (r.action_time + timedelta(hours=8)).strftime("%Y-%m-%d %H:%M:%S") if r.action_time else ""
|
||||
writer.writerow([
|
||||
r.action_time.strftime("%Y-%m-%d %H:%M:%S") if r.action_time else "",
|
||||
t_cst,
|
||||
r.username, r.user_role, r.action_type, r.action_subtype or "",
|
||||
f"{r.request_method} {r.request_path}", r.status_code, r.status,
|
||||
r.ip_address or "", r.description,
|
||||
@@ -132,7 +133,7 @@ def export_audit_logs(
|
||||
def _fmt(r: AuditLog, detail: bool = False) -> dict:
|
||||
base = {
|
||||
"id": r.id,
|
||||
"action_time": r.action_time.isoformat() if r.action_time else None,
|
||||
"action_time": (r.action_time.isoformat() + "Z") if r.action_time else None,
|
||||
"user_id": r.user_id,
|
||||
"username": r.username,
|
||||
"user_role": r.user_role,
|
||||
|
||||
Reference in New Issue
Block a user