474 lines
18 KiB
Go
474 lines
18 KiB
Go
package v1
|
||
|
||
import (
|
||
"github.com/gogf/gf/v2/frame/g"
|
||
)
|
||
|
||
// ===== 管理员日志管理 =====
|
||
|
||
// AdminLogListReq 管理员日志列表请求
|
||
type AdminLogListReq struct {
|
||
g.Meta `path:"/admin-log/list" method:"get" tags:"管理员日志" summary:"获取管理员日志列表"`
|
||
Page int `json:"page" v:"min:1" dc:"页码,默认1"`
|
||
Size int `json:"size" v:"min:1|max:100" dc:"每页数量,默认10"`
|
||
AdminId int `json:"admin_id" dc:"管理员ID"`
|
||
Module string `json:"module" dc:"模块名称"`
|
||
Action string `json:"action" dc:"操作类型"`
|
||
Status int `json:"status" dc:"状态:1成功,0失败"`
|
||
StartTime string `json:"start_time" dc:"开始时间"`
|
||
EndTime string `json:"end_time" dc:"结束时间"`
|
||
Keyword string `json:"keyword" dc:"关键词搜索"`
|
||
}
|
||
|
||
// AdminLogListRes 管理员日志列表响应
|
||
type AdminLogListRes struct {
|
||
List []AdminLogItem `json:"list" dc:"日志列表"`
|
||
Total int `json:"total" dc:"总数"`
|
||
Page int `json:"page" dc:"当前页"`
|
||
Size int `json:"size" dc:"每页数量"`
|
||
}
|
||
|
||
// AdminLogItem 管理员日志项
|
||
type AdminLogItem struct {
|
||
Id int `json:"id" dc:"日志ID"`
|
||
AdminId int `json:"admin_id" dc:"管理员ID"`
|
||
AdminName string `json:"admin_name" dc:"管理员名称"`
|
||
Module string `json:"module" dc:"模块名称"`
|
||
Action string `json:"action" dc:"操作类型"`
|
||
Description string `json:"description" dc:"操作描述"`
|
||
RequestData string `json:"request_data" dc:"请求数据"`
|
||
ResponseData string `json:"response_data" dc:"响应数据"`
|
||
Ip string `json:"ip" dc:"IP地址"`
|
||
UserAgent string `json:"user_agent" dc:"用户代理"`
|
||
Status int `json:"status" dc:"状态:1成功,0失败"`
|
||
ErrorMsg string `json:"error_msg" dc:"错误信息"`
|
||
CreatedAt string `json:"created_at" dc:"创建时间"`
|
||
}
|
||
|
||
// AdminLogDetailReq 管理员日志详情请求
|
||
type AdminLogDetailReq struct {
|
||
g.Meta `path:"/admin-log/detail" method:"get" tags:"管理员日志" summary:"获取管理员日志详情"`
|
||
Id int `json:"id" v:"required|min:1" dc:"日志ID"`
|
||
}
|
||
|
||
// AdminLogDetailRes 管理员日志详情响应
|
||
type AdminLogDetailRes struct {
|
||
Log AdminLogDetail `json:"log" dc:"日志详情"`
|
||
}
|
||
|
||
// AdminLogDetail 管理员日志详情
|
||
type AdminLogDetail struct {
|
||
Id int `json:"id" dc:"日志ID"`
|
||
AdminId int `json:"admin_id" dc:"管理员ID"`
|
||
AdminName string `json:"admin_name" dc:"管理员名称"`
|
||
Module string `json:"module" dc:"模块名称"`
|
||
Action string `json:"action" dc:"操作类型"`
|
||
Description string `json:"description" dc:"操作描述"`
|
||
RequestData string `json:"request_data" dc:"请求数据"`
|
||
ResponseData string `json:"response_data" dc:"响应数据"`
|
||
Ip string `json:"ip" dc:"IP地址"`
|
||
UserAgent string `json:"user_agent" dc:"用户代理"`
|
||
Status int `json:"status" dc:"状态:1成功,0失败"`
|
||
ErrorMsg string `json:"error_msg" dc:"错误信息"`
|
||
CreatedAt string `json:"created_at" dc:"创建时间"`
|
||
}
|
||
|
||
// AdminLogDeleteReq 删除管理员日志请求
|
||
type AdminLogDeleteReq struct {
|
||
g.Meta `path:"/admin-log/delete" method:"post" tags:"管理员日志" summary:"删除管理员日志"`
|
||
Id int `json:"id" v:"required|min:1" dc:"日志ID"`
|
||
}
|
||
|
||
// AdminLogDeleteRes 删除管理员日志响应
|
||
type AdminLogDeleteRes struct {
|
||
Message string `json:"message" dc:"操作结果"`
|
||
}
|
||
|
||
// AdminLogBatchDeleteReq 批量删除管理员日志请求
|
||
type AdminLogBatchDeleteReq struct {
|
||
g.Meta `path:"/admin-log/batch-delete" method:"post" tags:"管理员日志" summary:"批量删除管理员日志"`
|
||
Ids []int `json:"ids" v:"required" dc:"日志ID列表"`
|
||
}
|
||
|
||
// AdminLogBatchDeleteRes 批量删除管理员日志响应
|
||
type AdminLogBatchDeleteRes struct {
|
||
Message string `json:"message" dc:"操作结果"`
|
||
}
|
||
|
||
// AdminLogClearReq 清空管理员日志请求
|
||
type AdminLogClearReq struct {
|
||
g.Meta `path:"/admin-log/clear" method:"post" tags:"管理员日志" summary:"清空管理员日志"`
|
||
Days int `json:"days" dc:"保留天数,0表示全部清空"`
|
||
AdminId int `json:"admin_id" dc:"管理员ID,0表示所有管理员"`
|
||
Module string `json:"module" dc:"模块名称,空表示所有模块"`
|
||
}
|
||
|
||
// AdminLogClearRes 清空管理员日志响应
|
||
type AdminLogClearRes struct {
|
||
Message string `json:"message" dc:"操作结果"`
|
||
Count int `json:"count" dc:"清空数量"`
|
||
}
|
||
|
||
// AdminLogExportReq 导出管理员日志请求
|
||
type AdminLogExportReq struct {
|
||
g.Meta `path:"/admin-log/export" method:"get" tags:"管理员日志" summary:"导出管理员日志"`
|
||
AdminId int `json:"admin_id" dc:"管理员ID"`
|
||
Module string `json:"module" dc:"模块名称"`
|
||
Action string `json:"action" dc:"操作类型"`
|
||
Status int `json:"status" dc:"状态:1成功,0失败"`
|
||
StartTime string `json:"start_time" dc:"开始时间"`
|
||
EndTime string `json:"end_time" dc:"结束时间"`
|
||
Format string `json:"format" dc:"导出格式:excel,csv,json"`
|
||
}
|
||
|
||
// AdminLogExportRes 导出管理员日志响应
|
||
type AdminLogExportRes struct {
|
||
Content string `json:"content" dc:"导出内容"`
|
||
Filename string `json:"filename" dc:"文件名"`
|
||
}
|
||
|
||
// AdminLogStatsReq 管理员日志统计请求
|
||
type AdminLogStatsReq struct {
|
||
g.Meta `path:"/admin-log/stats" method:"get" tags:"管理员日志" summary:"获取管理员日志统计"`
|
||
AdminId int `json:"admin_id" dc:"管理员ID"`
|
||
StartTime string `json:"start_time" dc:"开始时间"`
|
||
EndTime string `json:"end_time" dc:"结束时间"`
|
||
Type string `json:"type" dc:"统计类型:day,week,month"`
|
||
}
|
||
|
||
// AdminLogStatsRes 管理员日志统计响应
|
||
type AdminLogStatsRes struct {
|
||
Stats AdminLogStatsData `json:"stats" dc:"统计数据"`
|
||
}
|
||
|
||
// AdminLogStatsData 管理员日志统计数据
|
||
type AdminLogStatsData struct {
|
||
Total int `json:"total" dc:"总数"`
|
||
Success int `json:"success" dc:"成功数"`
|
||
Failed int `json:"failed" dc:"失败数"`
|
||
SuccessRate float64 `json:"success_rate" dc:"成功率"`
|
||
ModuleStats []AdminLogModuleStats `json:"module_stats" dc:"模块统计"`
|
||
ActionStats []AdminLogActionStats `json:"action_stats" dc:"操作统计"`
|
||
TimeStats []AdminLogTimeStats `json:"time_stats" dc:"时间统计"`
|
||
AdminStats []AdminLogAdminStats `json:"admin_stats" dc:"管理员统计"`
|
||
}
|
||
|
||
// AdminLogModuleStats 模块统计
|
||
type AdminLogModuleStats struct {
|
||
Module string `json:"module" dc:"模块名称"`
|
||
Count int `json:"count" dc:"数量"`
|
||
}
|
||
|
||
// AdminLogActionStats 操作统计
|
||
type AdminLogActionStats struct {
|
||
Action string `json:"action" dc:"操作类型"`
|
||
Count int `json:"count" dc:"数量"`
|
||
}
|
||
|
||
// AdminLogTimeStats 时间统计
|
||
type AdminLogTimeStats struct {
|
||
Time string `json:"time" dc:"时间"`
|
||
Count int `json:"count" dc:"数量"`
|
||
}
|
||
|
||
// AdminLogAdminStats 管理员统计
|
||
type AdminLogAdminStats struct {
|
||
AdminId int `json:"admin_id" dc:"管理员ID"`
|
||
AdminName string `json:"admin_name" dc:"管理员名称"`
|
||
Count int `json:"count" dc:"数量"`
|
||
}
|
||
|
||
// ===== 用户日志管理 =====
|
||
|
||
// UserLogListReq 用户日志列表请求
|
||
type UserLogListReq struct {
|
||
g.Meta `path:"/user-log/list" method:"get" tags:"用户日志" summary:"获取用户日志列表"`
|
||
Page int `json:"page" v:"min:1" dc:"页码,默认1"`
|
||
Size int `json:"size" v:"min:1|max:100" dc:"每页数量,默认10"`
|
||
UserId int `json:"user_id" dc:"用户ID"`
|
||
Module string `json:"module" dc:"模块名称"`
|
||
Action string `json:"action" dc:"操作类型"`
|
||
Status int `json:"status" dc:"状态:1成功,0失败"`
|
||
StartTime string `json:"start_time" dc:"开始时间"`
|
||
EndTime string `json:"end_time" dc:"结束时间"`
|
||
Keyword string `json:"keyword" dc:"关键词搜索"`
|
||
}
|
||
|
||
// UserLogListRes 用户日志列表响应
|
||
type UserLogListRes struct {
|
||
List []UserLogItem `json:"list" dc:"日志列表"`
|
||
Total int `json:"total" dc:"总数"`
|
||
Page int `json:"page" dc:"当前页"`
|
||
Size int `json:"size" dc:"每页数量"`
|
||
}
|
||
|
||
// UserLogItem 用户日志项
|
||
type UserLogItem struct {
|
||
Id int `json:"id" dc:"日志ID"`
|
||
UserId int `json:"user_id" dc:"用户ID"`
|
||
Username string `json:"username" dc:"用户名"`
|
||
Module string `json:"module" dc:"模块名称"`
|
||
Action string `json:"action" dc:"操作类型"`
|
||
Description string `json:"description" dc:"操作描述"`
|
||
RequestData string `json:"request_data" dc:"请求数据"`
|
||
ResponseData string `json:"response_data" dc:"响应数据"`
|
||
Ip string `json:"ip" dc:"IP地址"`
|
||
UserAgent string `json:"user_agent" dc:"用户代理"`
|
||
Status int `json:"status" dc:"状态:1成功,0失败"`
|
||
ErrorMsg string `json:"error_msg" dc:"错误信息"`
|
||
CreatedAt string `json:"created_at" dc:"创建时间"`
|
||
}
|
||
|
||
// UserLogDetailReq 用户日志详情请求
|
||
type UserLogDetailReq struct {
|
||
g.Meta `path:"/user-log/detail" method:"get" tags:"用户日志" summary:"获取用户日志详情"`
|
||
Id int `json:"id" v:"required|min:1" dc:"日志ID"`
|
||
}
|
||
|
||
// UserLogDetailRes 用户日志详情响应
|
||
type UserLogDetailRes struct {
|
||
Log UserLogDetail `json:"log" dc:"日志详情"`
|
||
}
|
||
|
||
// UserLogDetail 用户日志详情
|
||
type UserLogDetail struct {
|
||
Id int `json:"id" dc:"日志ID"`
|
||
UserId int `json:"user_id" dc:"用户ID"`
|
||
Username string `json:"username" dc:"用户名"`
|
||
Module string `json:"module" dc:"模块名称"`
|
||
Action string `json:"action" dc:"操作类型"`
|
||
Description string `json:"description" dc:"操作描述"`
|
||
RequestData string `json:"request_data" dc:"请求数据"`
|
||
ResponseData string `json:"response_data" dc:"响应数据"`
|
||
Ip string `json:"ip" dc:"IP地址"`
|
||
UserAgent string `json:"user_agent" dc:"用户代理"`
|
||
Status int `json:"status" dc:"状态:1成功,0失败"`
|
||
ErrorMsg string `json:"error_msg" dc:"错误信息"`
|
||
CreatedAt string `json:"created_at" dc:"创建时间"`
|
||
}
|
||
|
||
// UserLogDeleteReq 删除用户日志请求
|
||
type UserLogDeleteReq struct {
|
||
g.Meta `path:"/user-log/delete" method:"post" tags:"用户日志" summary:"删除用户日志"`
|
||
Id int `json:"id" v:"required|min:1" dc:"日志ID"`
|
||
}
|
||
|
||
// UserLogDeleteRes 删除用户日志响应
|
||
type UserLogDeleteRes struct {
|
||
Message string `json:"message" dc:"操作结果"`
|
||
}
|
||
|
||
// UserLogBatchDeleteReq 批量删除用户日志请求
|
||
type UserLogBatchDeleteReq struct {
|
||
g.Meta `path:"/user-log/batch-delete" method:"post" tags:"用户日志" summary:"批量删除用户日志"`
|
||
Ids []int `json:"ids" v:"required" dc:"日志ID列表"`
|
||
}
|
||
|
||
// UserLogBatchDeleteRes 批量删除用户日志响应
|
||
type UserLogBatchDeleteRes struct {
|
||
Message string `json:"message" dc:"操作结果"`
|
||
}
|
||
|
||
// UserLogClearReq 清空用户日志请求
|
||
type UserLogClearReq struct {
|
||
g.Meta `path:"/user-log/clear" method:"post" tags:"用户日志" summary:"清空用户日志"`
|
||
Days int `json:"days" dc:"保留天数,0表示全部清空"`
|
||
UserId int `json:"user_id" dc:"用户ID,0表示所有用户"`
|
||
Module string `json:"module" dc:"模块名称,空表示所有模块"`
|
||
}
|
||
|
||
// UserLogClearRes 清空用户日志响应
|
||
type UserLogClearRes struct {
|
||
Message string `json:"message" dc:"操作结果"`
|
||
Count int `json:"count" dc:"清空数量"`
|
||
}
|
||
|
||
// UserLogExportReq 导出用户日志请求
|
||
type UserLogExportReq struct {
|
||
g.Meta `path:"/user-log/export" method:"get" tags:"用户日志" summary:"导出用户日志"`
|
||
UserId int `json:"user_id" dc:"用户ID"`
|
||
Module string `json:"module" dc:"模块名称"`
|
||
Action string `json:"action" dc:"操作类型"`
|
||
Status int `json:"status" dc:"状态:1成功,0失败"`
|
||
StartTime string `json:"start_time" dc:"开始时间"`
|
||
EndTime string `json:"end_time" dc:"结束时间"`
|
||
Format string `json:"format" dc:"导出格式:excel,csv,json"`
|
||
}
|
||
|
||
// UserLogExportRes 导出用户日志响应
|
||
type UserLogExportRes struct {
|
||
Content string `json:"content" dc:"导出内容"`
|
||
Filename string `json:"filename" dc:"文件名"`
|
||
}
|
||
|
||
// UserLogStatsReq 用户日志统计请求
|
||
type UserLogStatsReq struct {
|
||
g.Meta `path:"/user-log/stats" method:"get" tags:"用户日志" summary:"获取用户日志统计"`
|
||
UserId int `json:"user_id" dc:"用户ID"`
|
||
StartTime string `json:"start_time" dc:"开始时间"`
|
||
EndTime string `json:"end_time" dc:"结束时间"`
|
||
Type string `json:"type" dc:"统计类型:day,week,month"`
|
||
}
|
||
|
||
// UserLogStatsRes 用户日志统计响应
|
||
type UserLogStatsRes struct {
|
||
Stats UserLogStatsData `json:"stats" dc:"统计数据"`
|
||
}
|
||
|
||
// UserLogStatsData 用户日志统计数据
|
||
type UserLogStatsData struct {
|
||
Total int `json:"total" dc:"总数"`
|
||
Success int `json:"success" dc:"成功数"`
|
||
Failed int `json:"failed" dc:"失败数"`
|
||
SuccessRate float64 `json:"success_rate" dc:"成功率"`
|
||
ModuleStats []UserLogModuleStats `json:"module_stats" dc:"模块统计"`
|
||
ActionStats []UserLogActionStats `json:"action_stats" dc:"操作统计"`
|
||
TimeStats []UserLogTimeStats `json:"time_stats" dc:"时间统计"`
|
||
UserStats []UserLogUserStats `json:"user_stats" dc:"用户统计"`
|
||
}
|
||
|
||
// UserLogModuleStats 模块统计
|
||
type UserLogModuleStats struct {
|
||
Module string `json:"module" dc:"模块名称"`
|
||
Count int `json:"count" dc:"数量"`
|
||
}
|
||
|
||
// UserLogActionStats 操作统计
|
||
type UserLogActionStats struct {
|
||
Action string `json:"action" dc:"操作类型"`
|
||
Count int `json:"count" dc:"数量"`
|
||
}
|
||
|
||
// UserLogTimeStats 时间统计
|
||
type UserLogTimeStats struct {
|
||
Time string `json:"time" dc:"时间"`
|
||
Count int `json:"count" dc:"数量"`
|
||
}
|
||
|
||
// UserLogUserStats 用户统计
|
||
type UserLogUserStats struct {
|
||
UserId int `json:"user_id" dc:"用户ID"`
|
||
Username string `json:"username" dc:"用户名"`
|
||
Count int `json:"count" dc:"数量"`
|
||
}
|
||
|
||
// ===== 用户端日志查询 =====
|
||
|
||
// UserMyLogListReq 用户查看自己的日志列表请求
|
||
type UserMyLogListReq struct {
|
||
g.Meta `path:"/my-log/list" method:"get" tags:"用户日志" summary:"获取我的日志列表"`
|
||
Page int `json:"page" v:"min:1" dc:"页码,默认1"`
|
||
Size int `json:"size" v:"min:1|max:100" dc:"每页数量,默认10"`
|
||
Module string `json:"module" dc:"模块名称"`
|
||
Action string `json:"action" dc:"操作类型"`
|
||
StartTime string `json:"start_time" dc:"开始时间"`
|
||
EndTime string `json:"end_time" dc:"结束时间"`
|
||
}
|
||
|
||
// UserMyLogListRes 用户查看自己的日志列表响应
|
||
type UserMyLogListRes struct {
|
||
List []UserMyLogItem `json:"list" dc:"日志列表"`
|
||
Total int `json:"total" dc:"总数"`
|
||
Page int `json:"page" dc:"当前页"`
|
||
Size int `json:"size" dc:"每页数量"`
|
||
}
|
||
|
||
// UserMyLogItem 用户日志项
|
||
type UserMyLogItem struct {
|
||
Id int `json:"id" dc:"日志ID"`
|
||
Module string `json:"module" dc:"模块名称"`
|
||
Action string `json:"action" dc:"操作类型"`
|
||
Description string `json:"description" dc:"操作描述"`
|
||
Status int `json:"status" dc:"状态:1成功,0失败"`
|
||
CreatedAt string `json:"created_at" dc:"创建时间"`
|
||
}
|
||
|
||
// UserMyLogDetailReq 用户查看自己的日志详情请求
|
||
type UserMyLogDetailReq struct {
|
||
g.Meta `path:"/my-log/detail" method:"get" tags:"用户日志" summary:"获取我的日志详情"`
|
||
Id int `json:"id" v:"required|min:1" dc:"日志ID"`
|
||
}
|
||
|
||
// UserMyLogDetailRes 用户查看自己的日志详情响应
|
||
type UserMyLogDetailRes struct {
|
||
Log UserMyLogDetail `json:"log" dc:"日志详情"`
|
||
}
|
||
|
||
// UserMyLogDetail 用户日志详情
|
||
type UserMyLogDetail struct {
|
||
Id int `json:"id" dc:"日志ID"`
|
||
Module string `json:"module" dc:"模块名称"`
|
||
Action string `json:"action" dc:"操作类型"`
|
||
Description string `json:"description" dc:"操作描述"`
|
||
Status int `json:"status" dc:"状态:1成功,0失败"`
|
||
ErrorMsg string `json:"error_msg" dc:"错误信息"`
|
||
CreatedAt string `json:"created_at" dc:"创建时间"`
|
||
}
|
||
|
||
// ===== 系统日志管理 =====
|
||
|
||
// SystemLogListReq 系统日志列表请求
|
||
type SystemLogListReq struct {
|
||
g.Meta `path:"/system-log/list" method:"get" tags:"系统日志" summary:"获取系统日志列表"`
|
||
Page int `json:"page" v:"min:1" dc:"页码,默认1"`
|
||
Size int `json:"size" v:"min:1|max:100" dc:"每页数量,默认10"`
|
||
Level string `json:"level" dc:"日志级别:debug,info,warn,error"`
|
||
Module string `json:"module" dc:"模块名称"`
|
||
StartTime string `json:"start_time" dc:"开始时间"`
|
||
EndTime string `json:"end_time" dc:"结束时间"`
|
||
Keyword string `json:"keyword" dc:"关键词搜索"`
|
||
}
|
||
|
||
// SystemLogListRes 系统日志列表响应
|
||
type SystemLogListRes struct {
|
||
List []SystemLogItem `json:"list" dc:"日志列表"`
|
||
Total int `json:"total" dc:"总数"`
|
||
Page int `json:"page" dc:"当前页"`
|
||
Size int `json:"size" dc:"每页数量"`
|
||
}
|
||
|
||
// SystemLogItem 系统日志项
|
||
type SystemLogItem struct {
|
||
Id int `json:"id" dc:"日志ID"`
|
||
Level string `json:"level" dc:"日志级别"`
|
||
Module string `json:"module" dc:"模块名称"`
|
||
Message string `json:"message" dc:"日志消息"`
|
||
Context string `json:"context" dc:"上下文信息"`
|
||
CreatedAt string `json:"created_at" dc:"创建时间"`
|
||
}
|
||
|
||
// SystemLogDetailReq 系统日志详情请求
|
||
type SystemLogDetailReq struct {
|
||
g.Meta `path:"/system-log/detail" method:"get" tags:"系统日志" summary:"获取系统日志详情"`
|
||
Id int `json:"id" v:"required|min:1" dc:"日志ID"`
|
||
}
|
||
|
||
// SystemLogDetailRes 系统日志详情响应
|
||
type SystemLogDetailRes struct {
|
||
Log SystemLogDetail `json:"log" dc:"日志详情"`
|
||
}
|
||
|
||
// SystemLogDetail 系统日志详情
|
||
type SystemLogDetail struct {
|
||
Id int `json:"id" dc:"日志ID"`
|
||
Level string `json:"level" dc:"日志级别"`
|
||
Module string `json:"module" dc:"模块名称"`
|
||
Message string `json:"message" dc:"日志消息"`
|
||
Context string `json:"context" dc:"上下文信息"`
|
||
CreatedAt string `json:"created_at" dc:"创建时间"`
|
||
}
|
||
|
||
// SystemLogClearReq 清空系统日志请求
|
||
type SystemLogClearReq struct {
|
||
g.Meta `path:"/system-log/clear" method:"post" tags:"系统日志" summary:"清空系统日志"`
|
||
Days int `json:"days" dc:"保留天数,0表示全部清空"`
|
||
Level string `json:"level" dc:"日志级别,空表示所有级别"`
|
||
Module string `json:"module" dc:"模块名称,空表示所有模块"`
|
||
}
|
||
|
||
// SystemLogClearRes 清空系统日志响应
|
||
type SystemLogClearRes struct {
|
||
Message string `json:"message" dc:"操作结果"`
|
||
Count int `json:"count" dc:"清空数量"`
|
||
}
|