Files
common/log/model/dto/log_dto.go

60 lines
2.5 KiB
Go
Raw Normal View History

2025-12-30 16:14:15 +08:00
package dto
import (
"gitee.com/red-future---jilin-g/common/beans"
"github.com/gogf/gf/v2/frame/g"
)
// ========== 操作日志查询相关DTO ==========
// GetLogReq 获取操作日志请求
type GetLogReq struct {
g.Meta `path:"/getLog" method:"get" tags:"操作日志" summary:"获取操作日志详情" dc:"根据日志ID获取操作日志的详细信息"`
ID string `json:"id" v:"required" dc:"日志ID"`
}
// GetLogResp 获取操作日志响应
type GetLogResp struct {
OperationLogInfo
}
// OperationLogInfo 操作日志信息
type OperationLogInfo struct {
ID string `json:"id" dc:"日志ID"`
ServiceName string `json:"service_name" dc:"服务名"`
Collection string `json:"collection" dc:"数据所在集合名称"`
CollectionID string `json:"collection_id" dc:"数据ID"`
Operation string `json:"operation" dc:"操作类型"`
UserName string `json:"user_name" dc:"操作人名称"`
IPAddress string `json:"ip_address" dc:"操作IP地址"`
Data map[string]interface{} `json:"data" dc:"当前数据"`
2025-12-30 16:14:15 +08:00
}
// ListLogsReq 查询操作日志列表请求(通用方法,支持根据不同条件动态查询)
type ListLogsReq struct {
g.Meta `path:"/listLogs" method:"get" tags:"操作日志" summary:"查询操作日志列表" dc:"根据多个条件查询操作日志列表"`
beans.Page
ServiceName string `json:"service_name" dc:"服务名(可选)"`
Collection string `json:"collection" dc:"数据所在集合名称(可选)"`
CollectionID string `json:"collection_id" dc:"数据ID可选"`
Operation string `json:"operation" dc:"操作类型(可选)"`
StartTime string `json:"start_time" dc:"开始时间(可选)"`
EndTime string `json:"end_time" dc:"结束时间(可选)"`
SortFields string `json:"sort_fields" dc:"排序字段,多个用逗号分隔,如:-createdAt"`
2025-12-30 16:14:15 +08:00
}
// ListLogsResp 查询操作日志列表响应
type ListLogsResp struct {
Logs []OperationLogInfo `json:"logs" dc:"日志列表"`
Total int64 `json:"total" dc:"总数"`
}
// ========== 记录操作日志DTO ==========
// RecordCreateLogReq 记录创建操作日志请求
type RecordCreateLogReq struct {
ServiceName string `json:"service_name" v:"required" dc:"服务名"`
Collection string `json:"collection" v:"required" dc:"数据所在集合名称"`
Data []interface{} `json:"data" dc:"当前数据"`
2025-12-30 16:14:15 +08:00
}