Files
EasyGoAdmin_GoFrame_EleVue/api/v1/operation_log.go
T
2026-10-20 11:37:25 +08:00

90 lines
4.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package v1
import (
"github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/util/gmeta"
)
// ============================== 操作日志模块 ==============================
// OperLogItem 操作日志行数据
// 用于操作日志分页列表、操作日志列表等场景的日志基础信息
type OperLogItem struct {
Id int64 `json:"id"` // 主键ID
Title string `json:"title"` // 日志标题
Type int `json:"type"` // 类型
TypeText string `json:"typeText"` // 类型文本
Source int `json:"source"` // 来源
SourceText string `json:"sourceText"` // 来源文本
Method string `json:"method"` // 处理方法
RequestMethod string `json:"requestMethod"` // 请求方式
Url string `json:"url"` // 请求地址
Param string `json:"param"` // 请求参数
Result string `json:"result"` // 返回结果
Ip string `json:"ip"` // 客户端IP
Location string `json:"location"` // 归属地
Os string `json:"os"` // 操作系统
Browser string `json:"browser"` // 浏览器
ConsumeTime int64 `json:"consumeTime"` // 耗时(毫秒)
Status int `json:"status"` // 状态:0-正常 1-异常
StatusText string `json:"statusText"` // 状态文本
Error string `json:"error"` // 错误信息
CreateUser string `json:"createUser"` // 操作人
CreateTime *gtime.Time `json:"createTime"` // 创建时间
}
// OperLogPageReq 操作日志分页请求
// 支持关键词、日志标题、类型、状态等条件组合查询
type OperLogPageReq struct {
gmeta.Meta `method:"get" path:"/api/oper/log/page" summary:"操作日志分页" permission:"sys:operLog:page" log:"操作日志-查询分页记录" logType:"query"`
PageReq // 分页基础参数
Keyword string `json:"keyword" dc:"关键词(标题/URL模糊)"` // 关键词,标题或URL模糊匹配
Title string `json:"title" dc:"日志标题模糊"` // 日志标题模糊匹配
Type int `json:"type" dc:"类型(logType)"` // 类型
Status int `json:"status" dc:"状态:0-正常 1-异常"` // 状态
}
// OperLogPageRes 操作日志分页结果
type OperLogPageRes = PageData[OperLogItem]
// OperLogListReq 操作日志列表请求
type OperLogListReq struct {
gmeta.Meta `method:"get" path:"/api/oper/log/list" summary:"操作日志列表" permission:"sys:operLog:list" log:"操作日志-查询列表" logType:"query"`
Keyword string `json:"keyword" dc:"关键词"` // 关键词
Type int `json:"type" dc:"类型"` // 类型
Status int `json:"status" dc:"状态"` // 状态
Limit int `json:"limit" dc:"条数上限"` // 条数上限
}
// OperLogListRes 操作日志列表结果
type OperLogListRes = []OperLogItem
// OperLogDetailReq 操作日志详情请求
type OperLogDetailReq struct {
gmeta.Meta `method:"get" path:"/api/oper/log/detail/:id" summary:"操作日志详情" permission:"sys:operLog:detail" log:"操作日志-查询详情" logType:"query"`
Id int64 `json:"id" v:"required#缺少ID" dc:"日志ID"` // 日志ID
}
// OperLogDetailRes 操作日志详情结果
type OperLogDetailRes struct {
OperLogItem
}
// OperLogDeleteReq 删除操作日志请求
type OperLogDeleteReq struct {
gmeta.Meta `method:"delete" path:"/api/oper/log/delete/:id" summary:"删除操作日志" permission:"sys:operLog:delete" log:"操作日志-删除记录" logType:"delete"`
Id int64 `json:"id" v:"required#缺少ID" dc:"日志ID"` // 日志ID
}
// OperLogDeleteRes 删除操作日志结果
type OperLogDeleteRes struct{}
// OperLogBatchDeleteReq 批量删除操作日志请求
type OperLogBatchDeleteReq struct {
gmeta.Meta `method:"delete" path:"/api/oper/log/batchDelete" summary:"批量删除操作日志" permission:"sys:operLog:batchDelete" log:"操作日志-批量删除记录" logType:"delete"`
Ids []int64 `json:"ids" v:"required#请选择要删除的记录" dc:"日志ID列表"` // 日志ID列表
}
// OperLogBatchDeleteRes 批量删除结果
type OperLogBatchDeleteRes struct{}