- 修复前端路由守卫:未登录时不显示提示,直接跳转登录页 - 修复API拦截器:401错误不显示提示,直接跳转 - 增强验证码显示:图片尺寸从120x40增加到200x80 - 增大验证码字体:从28号增加到48号 - 优化验证码字符:排除易混淆的0和1 - 减少干扰线:从5条减少到3条,添加背景色优化 - 增强登录API日志:添加详细的调试日志 - 增强验证码生成和验证日志 - 优化异常处理和错误追踪 影响文件: - src/router/index.ts - src/api/request.ts - app/services/auth_service.py - app/api/v1/auth.py - app/schemas/user.py 测试状态: - 前端构建通过 - 后端语法检查通过 - 验证码显示效果优化完成 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
41 lines
1.9 KiB
Python
41 lines
1.9 KiB
Python
"""
|
|
操作日志数据模型
|
|
"""
|
|
from datetime import datetime
|
|
from sqlalchemy import Column, BigInteger, String, Text, Integer, DateTime, Index
|
|
from sqlalchemy.dialects.postgresql import JSONB
|
|
from app.db.base import Base
|
|
|
|
|
|
class OperationLog(Base):
|
|
"""操作日志表"""
|
|
|
|
__tablename__ = "operation_logs"
|
|
|
|
id = Column(BigInteger, primary_key=True, index=True)
|
|
operator_id = Column(BigInteger, nullable=False, index=True, comment="操作人ID")
|
|
operator_name = Column(String(100), nullable=False, comment="操作人姓名")
|
|
operator_ip = Column(String(50), nullable=True, comment="操作人IP")
|
|
module = Column(String(50), nullable=False, index=True, comment="模块名称")
|
|
operation_type = Column(String(50), nullable=False, index=True, comment="操作类型")
|
|
method = Column(String(10), nullable=False, comment="请求方法(GET/POST/PUT/DELETE等)")
|
|
url = Column(String(500), nullable=False, comment="请求URL")
|
|
params = Column(Text, nullable=True, comment="请求参数")
|
|
result = Column(String(20), default="success", nullable=False, comment="操作结果: success/failed")
|
|
error_msg = Column(Text, nullable=True, comment="错误信息")
|
|
duration = Column(Integer, nullable=True, comment="执行时长(毫秒)")
|
|
user_agent = Column(String(500), nullable=True, comment="用户代理")
|
|
extra_data = Column(JSONB, nullable=True, comment="额外数据")
|
|
created_at = Column(DateTime, default=datetime.utcnow, nullable=False, index=True)
|
|
|
|
# 索引
|
|
__table_args__ = (
|
|
Index("idx_operation_log_operator", "operator_id"),
|
|
Index("idx_operation_log_module", "module"),
|
|
Index("idx_operation_log_time", "created_at"),
|
|
Index("idx_operation_log_result", "result"),
|
|
)
|
|
|
|
def __repr__(self):
|
|
return f"<OperationLog(id={self.id}, operator={self.operator_name}, module={self.module}, operation={self.operation_type})>"
|