解决合并后出现的问题,为swagger提供禁用选项,暂时移除wiki

This commit is contained in:
2025-12-26 01:15:17 +08:00
parent 44f007936e
commit 85a9463913
90 changed files with 602 additions and 20104 deletions

View File

@@ -3,6 +3,7 @@ package types
import "time"
// BaseResponse 基础响应结构
// @Description 通用API响应结构
type BaseResponse struct {
Code int `json:"code"`
Message string `json:"message"`
@@ -10,12 +11,14 @@ type BaseResponse struct {
}
// PaginationRequest 分页请求
// @Description 分页查询参数
type PaginationRequest struct {
Page int `json:"page" form:"page" binding:"omitempty,min=1"`
PageSize int `json:"page_size" form:"page_size" binding:"omitempty,min=1,max=100"`
}
// PaginationResponse 分页响应
// @Description 分页查询结果
type PaginationResponse struct {
List interface{} `json:"list"`
Total int64 `json:"total"`
@@ -25,12 +28,14 @@ type PaginationResponse struct {
}
// LoginRequest 登录请求
// @Description 用户登录请求参数
type LoginRequest struct {
Username string `json:"username" binding:"required" example:"testuser"` // 支持用户名或邮箱
Password string `json:"password" binding:"required,min=6,max=128" example:"password123"`
}
// RegisterRequest 注册请求
// @Description 用户注册请求参数
type RegisterRequest struct {
Username string `json:"username" binding:"required,min=3,max=50" example:"newuser"`
Email string `json:"email" binding:"required,email" example:"user@example.com"`
@@ -40,6 +45,7 @@ type RegisterRequest struct {
}
// UpdateUserRequest 更新用户请求
// @Description 更新用户信息请求参数
type UpdateUserRequest struct {
Avatar string `json:"avatar" binding:"omitempty,url" example:"https://example.com/new-avatar.png"`
OldPassword string `json:"old_password" binding:"omitempty,min=6,max=128" example:"oldpassword123"` // 修改密码时必需
@@ -47,12 +53,14 @@ type UpdateUserRequest struct {
}
// SendVerificationCodeRequest 发送验证码请求
// @Description 发送邮箱验证码请求参数
type SendVerificationCodeRequest struct {
Email string `json:"email" binding:"required,email" example:"user@example.com"`
Type string `json:"type" binding:"required,oneof=register reset_password change_email" example:"register"` // 类型: register/reset_password/change_email
}
// ResetPasswordRequest 重置密码请求
// @Description 重置密码请求参数
type ResetPasswordRequest struct {
Email string `json:"email" binding:"required,email" example:"user@example.com"`
VerificationCode string `json:"verification_code" binding:"required,len=6" example:"123456"`
@@ -60,17 +68,20 @@ type ResetPasswordRequest struct {
}
// ChangeEmailRequest 更换邮箱请求
// @Description 更换邮箱请求参数
type ChangeEmailRequest struct {
NewEmail string `json:"new_email" binding:"required,email" example:"newemail@example.com"`
VerificationCode string `json:"verification_code" binding:"required,len=6" example:"123456"`
}
// CreateProfileRequest 创建档案请求
// @Description 创建Minecraft档案请求参数
type CreateProfileRequest struct {
Name string `json:"name" binding:"required,min=1,max=16" example:"PlayerName"`
}
// UpdateTextureRequest 更新材质请求
// @Description 更新材质信息请求参数
type UpdateTextureRequest struct {
Name string `json:"name" binding:"omitempty,min=1,max=100" example:"My Skin"`
Description string `json:"description" binding:"omitempty,max=500" example:"A cool skin"`
@@ -78,12 +89,14 @@ type UpdateTextureRequest struct {
}
// LoginResponse 登录响应
// @Description 登录成功响应数据
type LoginResponse struct {
Token string `json:"token"`
UserInfo *UserInfo `json:"user_info"`
}
// UserInfo 用户信息
// @Description 用户详细信息
type UserInfo struct {
ID int64 `json:"id" example:"1"`
Username string `json:"username" example:"testuser"`
@@ -106,6 +119,7 @@ const (
)
// TextureInfo 材质信息
// @Description 材质详细信息
type TextureInfo struct {
ID int64 `json:"id" example:"1"`
UploaderID int64 `json:"uploader_id" example:"1"`
@@ -125,6 +139,7 @@ type TextureInfo struct {
}
// ProfileInfo 角色信息
// @Description Minecraft档案信息
type ProfileInfo struct {
UUID string `json:"uuid" example:"550e8400-e29b-41d4-a716-446655440000"`
UserID int64 `json:"user_id" example:"1"`
@@ -137,12 +152,14 @@ type ProfileInfo struct {
}
// UploadURLRequest 上传URL请求
// @Description 获取材质上传URL请求参数
type UploadURLRequest struct {
Type TextureType `json:"type" binding:"required,oneof=SKIN CAPE"`
Filename string `json:"filename" binding:"required"`
}
// UploadURLResponse 上传URL响应
// @Description 材质上传URL响应数据
type UploadURLResponse struct {
PostURL string `json:"post_url"`
FormData map[string]string `json:"form_data"`
@@ -151,6 +168,7 @@ type UploadURLResponse struct {
}
// SearchTextureRequest 搜索材质请求
// @Description 搜索材质请求参数
type SearchTextureRequest struct {
PaginationRequest
Keyword string `json:"keyword" form:"keyword"`
@@ -159,6 +177,7 @@ type SearchTextureRequest struct {
}
// UpdateProfileRequest 更新角色请求
// @Description 更新Minecraft档案请求参数
type UpdateProfileRequest struct {
Name string `json:"name" binding:"omitempty,min=1,max=16" example:"NewPlayerName"`
SkinID *int64 `json:"skin_id,omitempty" example:"1"`
@@ -166,6 +185,7 @@ type UpdateProfileRequest struct {
}
// SystemConfigResponse 基础系统配置响应
// @Description 系统配置信息
type SystemConfigResponse struct {
SiteName string `json:"site_name" example:"CarrotSkin"`
SiteDescription string `json:"site_description" example:"A Minecraft Skin Station"`