244 lines
7.7 KiB
Go
244 lines
7.7 KiB
Go
package v1
|
|
|
|
import "github.com/gogf/gf/v2/frame/g"
|
|
|
|
// ===== 登录 =====
|
|
|
|
type LoginReq struct {
|
|
g.Meta `path:"/login" method:"post" tags:"admin" summary:"管理员登录"`
|
|
Account string `v:"required#请输入账号" json:"account"`
|
|
Password string `v:"required#请输入密码" json:"password"`
|
|
Remember bool `json:"remember"`
|
|
}
|
|
type LoginRes struct {
|
|
Token string `json:"token"`
|
|
NickName string `json:"nick_name"`
|
|
RoleName string `json:"role_name"`
|
|
RoleValue string `json:"role_value"`
|
|
}
|
|
|
|
type MyInfoReq struct {
|
|
g.Meta `path:"/user/my-info" method:"get" tags:"admin" summary:"当前管理员信息"`
|
|
}
|
|
type MyInfoRes struct {
|
|
Id int64 `json:"id"`
|
|
Account string `json:"account"`
|
|
NickName string `json:"nick_name"`
|
|
RoleName string `json:"role_name"`
|
|
RoleValue string `json:"role_value"`
|
|
}
|
|
|
|
// ===== 用户管理 =====
|
|
|
|
type AdminUserItem struct {
|
|
Id int64 `json:"id"`
|
|
Nickname string `json:"nickname"`
|
|
AvatarUrl string `json:"avatar_url"`
|
|
Openid string `json:"openid"`
|
|
LevelKey string `json:"level_key"`
|
|
LevelName string `json:"level_name"`
|
|
LevelExpireAt string `json:"level_expire_at"`
|
|
QuotaPeriodDays int `json:"quota_period_days"` // 0 = 跟随全局设置
|
|
Status int `json:"status"`
|
|
UsageCount int64 `json:"usage_count"`
|
|
LastUsedAt string `json:"last_used_at"`
|
|
CreatedAt string `json:"created_at"`
|
|
}
|
|
|
|
type UserListReq struct {
|
|
g.Meta `path:"/user/list" method:"get" tags:"admin" summary:"用户列表"`
|
|
Page int `json:"page"`
|
|
PageSize int `json:"pageSize"`
|
|
Keyword string `json:"keyword"`
|
|
}
|
|
type UserListRes struct {
|
|
List []AdminUserItem `json:"list"`
|
|
Total int `json:"total"`
|
|
}
|
|
|
|
type UserSetLevelReq struct {
|
|
g.Meta `path:"/user/set-level" method:"post" tags:"admin" summary:"设置用户等级"`
|
|
UserId int64 `v:"required" json:"userId"`
|
|
LevelKey string `v:"required" json:"levelKey"`
|
|
}
|
|
type UserSetLevelRes struct{}
|
|
|
|
type UserStatusReq struct {
|
|
g.Meta `path:"/user/status" method:"post" tags:"admin" summary:"启停用户"`
|
|
UserId int64 `v:"required" json:"userId"`
|
|
Status int `json:"status"`
|
|
}
|
|
type UserStatusRes struct{}
|
|
|
|
// ===== 等级管理 =====
|
|
|
|
type LevelItem struct {
|
|
Id int64 `json:"id"`
|
|
LevelKey string `json:"level_key"`
|
|
Name string `json:"name"`
|
|
Modules []string `json:"modules"`
|
|
Sort int `json:"sort"`
|
|
IsEnabled int `json:"is_enabled"`
|
|
Remark string `json:"remark"`
|
|
}
|
|
|
|
type LevelListReq struct {
|
|
g.Meta `path:"/level/list" method:"get" tags:"admin" summary:"等级列表"`
|
|
}
|
|
type LevelListRes struct {
|
|
List []LevelItem `json:"list"`
|
|
}
|
|
|
|
type LevelSaveReq struct {
|
|
g.Meta `path:"/level/save" method:"post" tags:"admin" summary:"保存等级"`
|
|
Id int64 `json:"id"`
|
|
LevelKey string `v:"required-if:id,0#等级标识不能为空" json:"levelKey"`
|
|
Name string `v:"required#等级名称不能为空" json:"name"`
|
|
Modules []string `v:"required#至少勾选一个模块" json:"modules"`
|
|
Sort int `json:"sort"`
|
|
IsEnabled int `json:"isEnabled"`
|
|
Remark string `json:"remark"`
|
|
}
|
|
type LevelSaveRes struct{}
|
|
|
|
// ===== 模块管理 =====
|
|
|
|
type ModuleItem struct {
|
|
Id int64 `json:"id"`
|
|
ModuleKey string `json:"module_key"`
|
|
Name string `json:"name"`
|
|
Icon string `json:"icon"`
|
|
Description string `json:"description"`
|
|
Sort int `json:"sort"`
|
|
IsEnabled int `json:"is_enabled"`
|
|
ToolCount int `json:"tool_count"`
|
|
}
|
|
|
|
type ModuleListReq struct {
|
|
g.Meta `path:"/module/list" method:"get" tags:"admin" summary:"模块列表"`
|
|
}
|
|
type ModuleListRes struct {
|
|
List []ModuleItem `json:"list"`
|
|
}
|
|
|
|
type ModuleSaveReq struct {
|
|
g.Meta `path:"/module/save" method:"post" tags:"admin" summary:"保存模块"`
|
|
Id int64 `json:"id"`
|
|
ModuleKey string `v:"required-if:id,0#模块标识不能为空" json:"moduleKey"`
|
|
Name string `v:"required#模块名称不能为空" json:"name"`
|
|
Icon string `json:"icon"`
|
|
Description string `json:"description"`
|
|
Sort int `json:"sort"`
|
|
IsEnabled int `json:"isEnabled"`
|
|
}
|
|
type ModuleSaveRes struct{}
|
|
|
|
// ===== 工具管理 =====
|
|
|
|
type AdminToolItem struct {
|
|
Id int64 `json:"id"`
|
|
ToolKey string `json:"tool_key"`
|
|
ModuleKey string `json:"module_key"`
|
|
ModuleName string `json:"module_name"`
|
|
Name string `json:"name"`
|
|
Icon string `json:"icon"`
|
|
Description string `json:"description"`
|
|
FreeQuota int `json:"free_quota"` // 免费额度(每周期次数)
|
|
MemberQuota int `json:"member_quota"` // 会员额度(每周期次数)
|
|
PayCost int `json:"pay_cost"` // 付费额度每次消耗系数
|
|
Sort int `json:"sort"`
|
|
IsEnabled int `json:"is_enabled"`
|
|
IsHot int `json:"is_hot"`
|
|
UsageCount int64 `json:"usage_count"`
|
|
}
|
|
|
|
type ToolsListReq struct {
|
|
g.Meta `path:"/tools/all" method:"get" tags:"admin" summary:"工具列表(全量)"`
|
|
Page int `json:"page"`
|
|
PageSize int `json:"pageSize"`
|
|
ModuleKey string `json:"moduleKey"`
|
|
Keyword string `json:"keyword"`
|
|
IncludeDisabled bool `json:"includeDisabled"`
|
|
}
|
|
type ToolsListRes struct {
|
|
List []AdminToolItem `json:"list"`
|
|
Total int `json:"total"`
|
|
}
|
|
|
|
type ToolsSaveReq struct {
|
|
g.Meta `path:"/tools/save" method:"post" tags:"admin" summary:"保存工具(含额度配置)"`
|
|
Id int64 `json:"id"`
|
|
ToolKey string `v:"required-if:id,0#工具标识不能为空" json:"toolKey"`
|
|
ModuleKey string `v:"required#所属模块不能为空" json:"moduleKey"`
|
|
Name string `v:"required#工具名称不能为空" json:"name"`
|
|
Icon string `json:"icon"`
|
|
Description string `json:"description"`
|
|
FreeQuota int `v:"min:0#免费额度不能为负" json:"freeQuota"`
|
|
MemberQuota int `v:"min:0#会员额度不能为负" json:"memberQuota"`
|
|
PayCost int `v:"min:1#付费消耗系数至少为 1" json:"payCost"`
|
|
Sort int `json:"sort"`
|
|
IsEnabled int `json:"isEnabled"`
|
|
IsHot int `json:"isHot"`
|
|
}
|
|
type ToolsSaveRes struct{}
|
|
|
|
type ToolsToggleReq struct {
|
|
g.Meta `path:"/tools/toggle" method:"post" tags:"admin" summary:"工具开关"`
|
|
Id int64 `v:"required" json:"id"`
|
|
Field string `v:"required|in:is_enabled,is_hot" json:"field"`
|
|
Value int `json:"value"`
|
|
}
|
|
type ToolsToggleRes struct{}
|
|
|
|
// ===== 数据看板 =====
|
|
|
|
type TrendItem struct {
|
|
Date string `json:"date"`
|
|
Count int64 `json:"count"`
|
|
}
|
|
|
|
type TopItem struct {
|
|
ToolKey string `json:"tool_key"`
|
|
Name string `json:"name"`
|
|
Count int64 `json:"count"`
|
|
}
|
|
|
|
type DashboardStatsReq struct {
|
|
g.Meta `path:"/dashboard/stats" method:"get" tags:"admin" summary:"看板统计"`
|
|
}
|
|
type DashboardStatsRes struct {
|
|
UserCount int64 `json:"userCount"`
|
|
TodayActive int64 `json:"todayActive"`
|
|
TotalUsage int64 `json:"totalUsage"`
|
|
WeekTrend []TrendItem `json:"weekTrend"`
|
|
ToolsTop []TopItem `json:"toolsTop"`
|
|
}
|
|
|
|
// ===== 反馈管理 =====
|
|
|
|
type FeedbackItem struct {
|
|
Id int64 `json:"id"`
|
|
UserId int64 `json:"user_id"`
|
|
Content string `json:"content"`
|
|
Contact string `json:"contact"`
|
|
Status int `json:"status"`
|
|
CreatedAt string `json:"created_at"`
|
|
}
|
|
|
|
type FeedbackListReq struct {
|
|
g.Meta `path:"/feedback/list" method:"get" tags:"admin" summary:"反馈列表"`
|
|
Page int `json:"page"`
|
|
PageSize int `json:"pageSize"`
|
|
Status *int `json:"status"`
|
|
}
|
|
type FeedbackListRes struct {
|
|
List []FeedbackItem `json:"list"`
|
|
Total int `json:"total"`
|
|
}
|
|
|
|
type FeedbackHandleReq struct {
|
|
g.Meta `path:"/feedback/handle" method:"post" tags:"admin" summary:"标记已处理"`
|
|
Id int64 `v:"required" json:"id"`
|
|
}
|
|
type FeedbackHandleRes struct{}
|