97 lines
5.1 KiB
Go
97 lines
5.1 KiB
Go
|
|
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"`
|
|||
|
|
Module string `json:"module" dc:"模块名"`
|
|||
|
|
Service string `json:"service" dc:"服务名"`
|
|||
|
|
Operation string `json:"operation" dc:"操作类型"`
|
|||
|
|
Resource string `json:"resource" dc:"资源类型"`
|
|||
|
|
ResourceID string `json:"resource_id" dc:"资源ID"`
|
|||
|
|
UserID interface{} `json:"user_id" dc:"操作人ID"`
|
|||
|
|
UserName string `json:"user_name" dc:"操作人名称"`
|
|||
|
|
IPAddress string `json:"ip_address" dc:"操作IP地址"`
|
|||
|
|
UserAgent string `json:"user_agent" dc:"用户代理"`
|
|||
|
|
Description string `json:"description" dc:"操作描述"`
|
|||
|
|
BeforeData map[string]interface{} `json:"before_data" dc:"操作前的数据"`
|
|||
|
|
AfterData map[string]interface{} `json:"after_data" dc:"操作后的数据"`
|
|||
|
|
ExtraData map[string]interface{} `json:"extra_data" dc:"额外数据"`
|
|||
|
|
CreatedAt string `json:"created_at" dc:"创建时间"`
|
|||
|
|
UpdatedAt string `json:"updated_at" dc:"更新时间"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ListLogsReq 查询操作日志列表请求(通用方法,支持根据不同条件动态查询)
|
|||
|
|
type ListLogsReq struct {
|
|||
|
|
g.Meta `path:"/listLogs" method:"get" tags:"操作日志" summary:"查询操作日志列表" dc:"根据多个条件查询操作日志列表"`
|
|||
|
|
beans.Page
|
|||
|
|
Module string `json:"module" dc:"模块名(可选)"`
|
|||
|
|
Service string `json:"service" dc:"服务名(可选)"`
|
|||
|
|
Operation string `json:"operation" dc:"操作类型(可选)"`
|
|||
|
|
Resource string `json:"resource" dc:"资源类型(可选)"`
|
|||
|
|
ResourceID string `json:"resource_id" dc:"资源ID(可选)"`
|
|||
|
|
UserID string `json:"user_id" dc:"用户ID(可选)"`
|
|||
|
|
StartTime string `json:"start_time" dc:"开始时间(可选)"`
|
|||
|
|
EndTime string `json:"end_time" dc:"结束时间(可选)"`
|
|||
|
|
SortFields string `json:"sort_fields" dc:"排序字段,多个用逗号分隔,如:-createdAt,module(可选)"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ListLogsResp 查询操作日志列表响应
|
|||
|
|
type ListLogsResp struct {
|
|||
|
|
Logs []OperationLogInfo `json:"logs" dc:"日志列表"`
|
|||
|
|
Total int64 `json:"total" dc:"总数"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ========== 记录操作日志DTO ==========
|
|||
|
|
|
|||
|
|
// RecordCreateLogReq 记录创建操作日志请求
|
|||
|
|
type RecordCreateLogReq struct {
|
|||
|
|
g.Meta `path:"/recordCreateLog" method:"post" tags:"操作日志" summary:"记录创建操作日志" dc:"记录数据创建操作的行为日志"`
|
|||
|
|
Module string `json:"module" v:"required" dc:"模块名"`
|
|||
|
|
Service string `json:"service" v:"required" dc:"服务名"`
|
|||
|
|
Resource string `json:"resource" v:"required" dc:"资源类型"`
|
|||
|
|
ResourceID string `json:"resource_id" v:"required" dc:"资源ID"`
|
|||
|
|
Description string `json:"description" dc:"操作描述"`
|
|||
|
|
AfterData map[string]interface{} `json:"after_data" dc:"操作后的数据"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// RecordUpdateLogReq 记录更新操作日志请求
|
|||
|
|
type RecordUpdateLogReq struct {
|
|||
|
|
g.Meta `path:"/recordUpdateLog" method:"post" tags:"操作日志" summary:"记录更新操作日志" dc:"记录数据更新操作的行为日志"`
|
|||
|
|
Module string `json:"module" v:"required" dc:"模块名"`
|
|||
|
|
Service string `json:"service" v:"required" dc:"服务名"`
|
|||
|
|
Resource string `json:"resource" v:"required" dc:"资源类型"`
|
|||
|
|
ResourceID string `json:"resource_id" v:"required" dc:"资源ID"`
|
|||
|
|
Description string `json:"description" dc:"操作描述"`
|
|||
|
|
BeforeData map[string]interface{} `json:"before_data" dc:"操作前的数据"`
|
|||
|
|
AfterData map[string]interface{} `json:"after_data" dc:"操作后的数据"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// RecordDeleteLogReq 记录删除操作日志请求
|
|||
|
|
type RecordDeleteLogReq struct {
|
|||
|
|
g.Meta `path:"/recordDeleteLog" method:"post" tags:"操作日志" summary:"记录删除操作日志" dc:"记录数据删除操作的行为日志"`
|
|||
|
|
Module string `json:"module" v:"required" dc:"模块名"`
|
|||
|
|
Service string `json:"service" v:"required" dc:"服务名"`
|
|||
|
|
Resource string `json:"resource" v:"required" dc:"资源类型"`
|
|||
|
|
ResourceID string `json:"resource_id" v:"required" dc:"资源ID"`
|
|||
|
|
Description string `json:"description" dc:"操作描述"`
|
|||
|
|
BeforeData map[string]interface{} `json:"before_data" dc:"操作前的数据"`
|
|||
|
|
}
|