314 lines
13 KiB
Go
314 lines
13 KiB
Go
package v1
|
||
|
||
import "github.com/gogf/gf/v2/frame/g"
|
||
|
||
// ===== 系统配置管理相关结构 =====
|
||
|
||
// ConfigListReq 获取配置列表请求
|
||
type ConfigListReq struct {
|
||
g.Meta `path:"/config/list" method:"get" summary:"获取配置列表" tags:"系统配置管理"`
|
||
Page int `json:"page" dc:"页码,默认1"`
|
||
Size int `json:"size" dc:"每页数量,默认10"`
|
||
Group string `json:"group" dc:"配置分组"`
|
||
Keyword string `json:"keyword" dc:"搜索关键词"`
|
||
Status int `json:"status" dc:"状态:0-禁用,1-启用"`
|
||
}
|
||
|
||
// ConfigListRes 获取配置列表响应
|
||
type ConfigListRes struct {
|
||
List []ConfigItem `json:"list" dc:"配置列表"`
|
||
Total int `json:"total" dc:"总数"`
|
||
Page int `json:"page" dc:"当前页码"`
|
||
Size int `json:"size" dc:"每页数量"`
|
||
}
|
||
|
||
// ConfigItem 配置项
|
||
type ConfigItem struct {
|
||
Id uint `json:"id" dc:"配置ID"`
|
||
Name string `json:"name" dc:"配置名称"`
|
||
Key string `json:"key" dc:"配置键"`
|
||
Value string `json:"value" dc:"配置值"`
|
||
Group string `json:"group" dc:"配置分组"`
|
||
Type string `json:"type" dc:"配置类型"`
|
||
Description string `json:"description" dc:"配置描述"`
|
||
Sort int `json:"sort" dc:"排序"`
|
||
Status int `json:"status" dc:"状态:0-禁用,1-启用"`
|
||
CreatedAt string `json:"created_at" dc:"创建时间"`
|
||
UpdatedAt string `json:"updated_at" dc:"更新时间"`
|
||
}
|
||
|
||
// ConfigDetailReq 获取配置详情请求
|
||
type ConfigDetailReq struct {
|
||
g.Meta `path:"/config/detail" method:"get" summary:"获取配置详情" tags:"系统配置管理"`
|
||
Id uint `json:"id" v:"required|min:1#请输入配置ID|配置ID不能为空" dc:"配置ID"`
|
||
}
|
||
|
||
// ConfigDetailRes 获取配置详情响应
|
||
type ConfigDetailRes struct {
|
||
Config ConfigDetail `json:"config" dc:"配置详情"`
|
||
}
|
||
|
||
// ConfigDetail 配置详情
|
||
type ConfigDetail struct {
|
||
Id uint `json:"id" dc:"配置ID"`
|
||
Name string `json:"name" dc:"配置名称"`
|
||
Key string `json:"key" dc:"配置键"`
|
||
Value string `json:"value" dc:"配置值"`
|
||
Group string `json:"group" dc:"配置分组"`
|
||
Type string `json:"type" dc:"配置类型"`
|
||
Description string `json:"description" dc:"配置描述"`
|
||
Sort int `json:"sort" dc:"排序"`
|
||
Status int `json:"status" dc:"状态:0-禁用,1-启用"`
|
||
CreatedAt string `json:"created_at" dc:"创建时间"`
|
||
UpdatedAt string `json:"updated_at" dc:"更新时间"`
|
||
}
|
||
|
||
// ConfigCreateReq 创建配置请求
|
||
type ConfigCreateReq struct {
|
||
g.Meta `path:"/config/create" method:"post" summary:"创建配置" tags:"系统配置管理"`
|
||
Name string `json:"name" v:"required|length:1,100#请输入配置名称|配置名称长度为1-100个字符" dc:"配置名称"`
|
||
Key string `json:"key" v:"required|length:1,100#请输入配置键|配置键长度为1-100个字符" dc:"配置键"`
|
||
Value string `json:"value" dc:"配置值"`
|
||
Group string `json:"group" v:"required|length:1,50#请输入配置分组|配置分组长度为1-50个字符" dc:"配置分组"`
|
||
Type string `json:"type" v:"required|in:string,int,float,bool,json#请选择配置类型|配置类型必须为string,int,float,bool,json之一" dc:"配置类型"`
|
||
Description string `json:"description" dc:"配置描述"`
|
||
Sort int `json:"sort" dc:"排序"`
|
||
Status int `json:"status" v:"in:0,1#状态值错误" dc:"状态:0-禁用,1-启用"`
|
||
}
|
||
|
||
// ConfigUpdateReq 更新配置请求
|
||
type ConfigUpdateReq struct {
|
||
g.Meta `path:"/config/update" method:"post" summary:"更新配置" tags:"系统配置管理"`
|
||
Id uint `json:"id" v:"required|min:1#请输入配置ID|配置ID不能为空" dc:"配置ID"`
|
||
Name string `json:"name" v:"required|length:1,100#请输入配置名称|配置名称长度为1-100个字符" dc:"配置名称"`
|
||
Value string `json:"value" dc:"配置值"`
|
||
Group string `json:"group" v:"required|length:1,50#请输入配置分组|配置分组长度为1-50个字符" dc:"配置分组"`
|
||
Type string `json:"type" v:"required|in:string,int,float,bool,json#请选择配置类型|配置类型必须为string,int,float,bool,json之一" dc:"配置类型"`
|
||
Description string `json:"description" dc:"配置描述"`
|
||
Sort int `json:"sort" dc:"排序"`
|
||
Status int `json:"status" v:"in:0,1#状态值错误" dc:"状态:0-禁用,1-启用"`
|
||
}
|
||
|
||
// ConfigDeleteReq 删除配置请求
|
||
type ConfigDeleteReq struct {
|
||
g.Meta `path:"/config/delete" method:"post" summary:"删除配置" tags:"系统配置管理"`
|
||
Id uint `json:"id" v:"required|min:1#请输入配置ID|配置ID不能为空" dc:"配置ID"`
|
||
}
|
||
|
||
// ConfigBatchDeleteReq 批量删除配置请求
|
||
type ConfigBatchDeleteReq struct {
|
||
g.Meta `path:"/config/batch-delete" method:"post" summary:"批量删除配置" tags:"系统配置管理"`
|
||
Ids []uint `json:"ids" v:"required|length:1,100#请选择要删除的配置|最多选择100个配置" dc:"配置ID列表"`
|
||
}
|
||
|
||
// ConfigGetByKeyReq 根据键获取配置请求
|
||
type ConfigGetByKeyReq struct {
|
||
g.Meta `path:"/config/get-by-key" method:"get" summary:"根据键获取配置" tags:"系统配置管理"`
|
||
Key string `json:"key" v:"required#请输入配置键" dc:"配置键"`
|
||
}
|
||
|
||
// ConfigGetByKeyRes 根据键获取配置响应
|
||
type ConfigGetByKeyRes struct {
|
||
Value string `json:"value" dc:"配置值"`
|
||
}
|
||
|
||
// ConfigGetByGroupReq 根据分组获取配置请求
|
||
type ConfigGetByGroupReq struct {
|
||
g.Meta `path:"/config/get-by-group" method:"get" summary:"根据分组获取配置" tags:"系统配置管理"`
|
||
Group string `json:"group" v:"required#请输入配置分组" dc:"配置分组"`
|
||
}
|
||
|
||
// ConfigGetByGroupRes 根据分组获取配置响应
|
||
type ConfigGetByGroupRes struct {
|
||
Configs []ConfigGroupItem `json:"configs" dc:"配置列表"`
|
||
}
|
||
|
||
// ConfigGroupItem 分组配置项
|
||
type ConfigGroupItem struct {
|
||
Key string `json:"key" dc:"配置键"`
|
||
Value string `json:"value" dc:"配置值"`
|
||
Name string `json:"name" dc:"配置名称"`
|
||
Type string `json:"type" dc:"配置类型"`
|
||
Description string `json:"description" dc:"配置描述"`
|
||
}
|
||
|
||
// ConfigSetReq 设置配置请求
|
||
type ConfigSetReq struct {
|
||
g.Meta `path:"/config/set" method:"post" summary:"设置配置" tags:"系统配置管理"`
|
||
Key string `json:"key" v:"required#请输入配置键" dc:"配置键"`
|
||
Value string `json:"value" dc:"配置值"`
|
||
}
|
||
|
||
// ConfigBatchSetReq 批量设置配置请求
|
||
type ConfigBatchSetReq struct {
|
||
g.Meta `path:"/config/batch-set" method:"post" summary:"批量设置配置" tags:"系统配置管理"`
|
||
Configs []ConfigSetItem `json:"configs" v:"required|length:1,100#请输入配置列表|最多设置100个配置" dc:"配置列表"`
|
||
}
|
||
|
||
// ConfigSetItem 设置配置项
|
||
type ConfigSetItem struct {
|
||
Key string `json:"key" v:"required#请输入配置键" dc:"配置键"`
|
||
Value string `json:"value" dc:"配置值"`
|
||
}
|
||
|
||
// ConfigGroupListReq 获取配置分组列表请求
|
||
type ConfigGroupListReq struct {
|
||
g.Meta `path:"/config/group/list" method:"get" summary:"获取配置分组列表" tags:"系统配置管理"`
|
||
}
|
||
|
||
// ConfigGroupListRes 获取配置分组列表响应
|
||
type ConfigGroupListRes struct {
|
||
Groups []ConfigGroupStatItem `json:"groups" dc:"分组列表"`
|
||
}
|
||
|
||
// ConfigGroupStatItem 配置分组统计项
|
||
type ConfigGroupStatItem struct {
|
||
Group string `json:"group" dc:"分组名称"`
|
||
Count int `json:"count" dc:"配置数量"`
|
||
Description string `json:"description" dc:"分组描述"`
|
||
}
|
||
|
||
// ConfigExportReq 导出配置请求
|
||
type ConfigExportReq struct {
|
||
g.Meta `path:"/config/export" method:"get" summary:"导出配置" tags:"系统配置管理"`
|
||
Group string `json:"group" dc:"配置分组,为空则导出全部"`
|
||
Format string `json:"format" v:"in:json,yaml,ini#导出格式错误" dc:"导出格式:json,yaml,ini"`
|
||
}
|
||
|
||
// ConfigExportRes 导出配置响应
|
||
type ConfigExportRes struct {
|
||
Content string `json:"content" dc:"导出内容"`
|
||
Filename string `json:"filename" dc:"文件名"`
|
||
}
|
||
|
||
// ConfigImportReq 导入配置请求
|
||
type ConfigImportReq struct {
|
||
g.Meta `path:"/config/import" method:"post" summary:"导入配置" tags:"系统配置管理"`
|
||
Content string `json:"content" v:"required#请输入导入内容" dc:"导入内容"`
|
||
Format string `json:"format" v:"required|in:json,yaml,ini#请选择导入格式|导入格式必须为json,yaml,ini之一" dc:"导入格式"`
|
||
Group string `json:"group" dc:"目标分组,为空则使用原分组"`
|
||
Mode string `json:"mode" v:"in:merge,replace#导入模式错误" dc:"导入模式:merge-合并,replace-替换"`
|
||
}
|
||
|
||
// ConfigImportRes 导入配置响应
|
||
type ConfigImportRes struct {
|
||
Success int `json:"success" dc:"成功导入数量"`
|
||
Failed int `json:"failed" dc:"失败数量"`
|
||
Total int `json:"total" dc:"总数量"`
|
||
}
|
||
|
||
// ConfigCacheReq 缓存配置请求
|
||
type ConfigCacheReq struct {
|
||
g.Meta `path:"/config/cache" method:"post" summary:"缓存配置" tags:"系统配置管理"`
|
||
Group string `json:"group" dc:"配置分组,为空则缓存全部"`
|
||
}
|
||
|
||
// ConfigClearCacheReq 清除配置缓存请求
|
||
type ConfigClearCacheReq struct {
|
||
g.Meta `path:"/config/clear-cache" method:"post" summary:"清除配置缓存" tags:"系统配置管理"`
|
||
Group string `json:"group" dc:"配置分组,为空则清除全部"`
|
||
}
|
||
|
||
// ConfigValidateReq 验证配置请求
|
||
type ConfigValidateReq struct {
|
||
g.Meta `path:"/config/validate" method:"post" summary:"验证配置" tags:"系统配置管理"`
|
||
Key string `json:"key" v:"required#请输入配置键" dc:"配置键"`
|
||
Value string `json:"value" dc:"配置值"`
|
||
Type string `json:"type" v:"required|in:string,int,float,bool,json#请选择配置类型|配置类型必须为string,int,float,bool,json之一" dc:"配置类型"`
|
||
}
|
||
|
||
// ConfigValidateRes 验证配置响应
|
||
type ConfigValidateRes struct {
|
||
Valid bool `json:"valid" dc:"是否有效"`
|
||
Message string `json:"message" dc:"验证消息"`
|
||
}
|
||
|
||
// ConfigBackupReq 备份配置请求
|
||
type ConfigBackupReq struct {
|
||
g.Meta `path:"/config/backup" method:"post" summary:"备份配置" tags:"系统配置管理"`
|
||
Name string `json:"name" v:"required|length:1,100#请输入备份名称|备份名称长度为1-100个字符" dc:"备份名称"`
|
||
Group string `json:"group" dc:"配置分组,为空则备份全部"`
|
||
}
|
||
|
||
// ConfigBackupRes 备份配置响应
|
||
type ConfigBackupRes struct {
|
||
BackupId string `json:"backup_id" dc:"备份ID"`
|
||
Filename string `json:"filename" dc:"备份文件名"`
|
||
}
|
||
|
||
// ConfigRestoreReq 恢复配置请求
|
||
type ConfigRestoreReq struct {
|
||
g.Meta `path:"/config/restore" method:"post" summary:"恢复配置" tags:"系统配置管理"`
|
||
BackupId string `json:"backup_id" v:"required#请输入备份ID" dc:"备份ID"`
|
||
Mode string `json:"mode" v:"in:merge,replace#恢复模式错误" dc:"恢复模式:merge-合并,replace-替换"`
|
||
}
|
||
|
||
// ConfigRestoreRes 恢复配置响应
|
||
type ConfigRestoreRes struct {
|
||
Success int `json:"success" dc:"成功恢复数量"`
|
||
Failed int `json:"failed" dc:"失败数量"`
|
||
Total int `json:"total" dc:"总数量"`
|
||
}
|
||
|
||
// ConfigHistoryReq 获取配置历史请求
|
||
type ConfigHistoryReq struct {
|
||
g.Meta `path:"/config/history" method:"get" summary:"获取配置历史" tags:"系统配置管理"`
|
||
Key string `json:"key" v:"required#请输入配置键" dc:"配置键"`
|
||
Page int `json:"page" dc:"页码,默认1"`
|
||
Size int `json:"size" dc:"每页数量,默认10"`
|
||
}
|
||
|
||
// ConfigHistoryRes 获取配置历史响应
|
||
type ConfigHistoryRes struct {
|
||
List []ConfigHistoryItem `json:"list" dc:"历史列表"`
|
||
Total int `json:"total" dc:"总数"`
|
||
Page int `json:"page" dc:"当前页码"`
|
||
Size int `json:"size" dc:"每页数量"`
|
||
}
|
||
|
||
// ConfigHistoryItem 配置历史项
|
||
type ConfigHistoryItem struct {
|
||
Id uint `json:"id" dc:"历史ID"`
|
||
Key string `json:"key" dc:"配置键"`
|
||
OldValue string `json:"old_value" dc:"旧值"`
|
||
NewValue string `json:"new_value" dc:"新值"`
|
||
Operation string `json:"operation" dc:"操作类型"`
|
||
UserId uint `json:"user_id" dc:"操作用户ID"`
|
||
Username string `json:"username" dc:"操作用户名"`
|
||
CreatedAt string `json:"created_at" dc:"操作时间"`
|
||
}
|
||
|
||
// ===== 用户端配置相关结构 =====
|
||
|
||
// ConfigUserGetReq 用户获取配置请求
|
||
type ConfigUserGetReq struct {
|
||
g.Meta `path:"/config/get" method:"get" summary:"获取配置" tags:"用户配置"`
|
||
Key string `json:"key" v:"required#请输入配置键" dc:"配置键"`
|
||
}
|
||
|
||
// ConfigUserGetRes 用户获取配置响应
|
||
type ConfigUserGetRes struct {
|
||
Value string `json:"value" dc:"配置值"`
|
||
}
|
||
|
||
// ConfigUserGetGroupReq 用户获取分组配置请求
|
||
type ConfigUserGetGroupReq struct {
|
||
g.Meta `path:"/config/group" method:"get" summary:"获取分组配置" tags:"用户配置"`
|
||
Group string `json:"group" v:"required#请输入配置分组" dc:"配置分组"`
|
||
}
|
||
|
||
// ConfigUserGetGroupRes 用户获取分组配置响应
|
||
type ConfigUserGetGroupRes struct {
|
||
Configs map[string]string `json:"configs" dc:"配置键值对"`
|
||
}
|
||
|
||
// ConfigUserGetPublicReq 用户获取公开配置请求
|
||
type ConfigUserGetPublicReq struct {
|
||
g.Meta `path:"/config/public" method:"get" summary:"获取公开配置" tags:"用户配置"`
|
||
}
|
||
|
||
// ConfigUserGetPublicRes 用户获取公开配置响应
|
||
type ConfigUserGetPublicRes struct {
|
||
Configs map[string]interface{} `json:"configs" dc:"公开配置"`
|
||
}
|