解决合并后出现的问题,为swagger提供禁用选项,暂时移除wiki
This commit is contained in:
@@ -25,6 +25,16 @@ func NewTextureHandler(c *container.Container) *TextureHandler {
|
||||
}
|
||||
|
||||
// Get 获取材质详情
|
||||
// @Summary 获取材质详情
|
||||
// @Description 获取指定ID的材质详细信息
|
||||
// @Tags texture
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int true "材质ID"
|
||||
// @Success 200 {object} model.Response{data=types.TextureInfo} "获取成功"
|
||||
// @Failure 400 {object} model.ErrorResponse "参数错误"
|
||||
// @Failure 404 {object} model.ErrorResponse "材质不存在"
|
||||
// @Router /api/v1/texture/{id} [get]
|
||||
func (h *TextureHandler) Get(c *gin.Context) {
|
||||
id, err := strconv.ParseInt(c.Param("id"), 10, 64)
|
||||
if err != nil {
|
||||
@@ -42,6 +52,19 @@ func (h *TextureHandler) Get(c *gin.Context) {
|
||||
}
|
||||
|
||||
// Search 搜索材质
|
||||
// @Summary 搜索材质
|
||||
// @Description 搜索材质列表,支持关键词、类型、公开性筛选和分页
|
||||
// @Tags texture
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param keyword query string false "关键词"
|
||||
// @Param type query string false "材质类型 (SKIN/CAPE)"
|
||||
// @Param public_only query boolean false "仅显示公开材质"
|
||||
// @Param page query int false "页码" default(1)
|
||||
// @Param page_size query int false "每页数量" default(20)
|
||||
// @Success 200 {object} model.Response{data=map[string]interface{}} "获取成功"
|
||||
// @Failure 500 {object} model.ErrorResponse "服务器错误"
|
||||
// @Router /api/v1/texture [get]
|
||||
func (h *TextureHandler) Search(c *gin.Context) {
|
||||
keyword := c.Query("keyword")
|
||||
textureTypeStr := c.Query("type")
|
||||
@@ -85,6 +108,18 @@ func (h *TextureHandler) Search(c *gin.Context) {
|
||||
}
|
||||
|
||||
// Update 更新材质
|
||||
// @Summary 更新材质
|
||||
// @Description 更新材质信息(名称、描述、公开性)
|
||||
// @Tags texture
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param id path int true "材质ID"
|
||||
// @Param request body types.UpdateTextureRequest true "更新信息"
|
||||
// @Success 200 {object} model.Response{data=types.TextureInfo} "更新成功"
|
||||
// @Failure 400 {object} model.ErrorResponse "参数错误"
|
||||
// @Failure 403 {object} model.ErrorResponse "无权操作"
|
||||
// @Router /api/v1/texture/{id} [put]
|
||||
func (h *TextureHandler) Update(c *gin.Context) {
|
||||
userID, ok := GetUserIDFromContext(c)
|
||||
if !ok {
|
||||
@@ -118,6 +153,17 @@ func (h *TextureHandler) Update(c *gin.Context) {
|
||||
}
|
||||
|
||||
// Delete 删除材质
|
||||
// @Summary 删除材质
|
||||
// @Description 删除指定ID的材质
|
||||
// @Tags texture
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param id path int true "材质ID"
|
||||
// @Success 200 {object} model.Response "删除成功"
|
||||
// @Failure 400 {object} model.ErrorResponse "参数错误"
|
||||
// @Failure 403 {object} model.ErrorResponse "无权操作"
|
||||
// @Router /api/v1/texture/{id} [delete]
|
||||
func (h *TextureHandler) Delete(c *gin.Context) {
|
||||
userID, ok := GetUserIDFromContext(c)
|
||||
if !ok {
|
||||
@@ -144,6 +190,16 @@ func (h *TextureHandler) Delete(c *gin.Context) {
|
||||
}
|
||||
|
||||
// ToggleFavorite 切换收藏状态
|
||||
// @Summary 切换收藏状态
|
||||
// @Description 收藏或取消收藏指定材质
|
||||
// @Tags texture
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param id path int true "材质ID"
|
||||
// @Success 200 {object} model.Response{data=map[string]bool} "操作成功"
|
||||
// @Failure 400 {object} model.ErrorResponse "参数错误"
|
||||
// @Router /api/v1/texture/{id} [post]
|
||||
func (h *TextureHandler) ToggleFavorite(c *gin.Context) {
|
||||
userID, ok := GetUserIDFromContext(c)
|
||||
if !ok {
|
||||
@@ -171,6 +227,17 @@ func (h *TextureHandler) ToggleFavorite(c *gin.Context) {
|
||||
}
|
||||
|
||||
// GetUserTextures 获取用户上传的材质列表
|
||||
// @Summary 获取我的材质
|
||||
// @Description 获取当前登录用户上传的材质列表
|
||||
// @Tags texture
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param page query int false "页码" default(1)
|
||||
// @Param page_size query int false "每页数量" default(20)
|
||||
// @Success 200 {object} model.Response{data=map[string]interface{}} "获取成功"
|
||||
// @Failure 500 {object} model.ErrorResponse "服务器错误"
|
||||
// @Router /api/v1/texture/my [get]
|
||||
func (h *TextureHandler) GetUserTextures(c *gin.Context) {
|
||||
userID, ok := GetUserIDFromContext(c)
|
||||
if !ok {
|
||||
@@ -196,6 +263,17 @@ func (h *TextureHandler) GetUserTextures(c *gin.Context) {
|
||||
}
|
||||
|
||||
// GetUserFavorites 获取用户收藏的材质列表
|
||||
// @Summary 获取我的收藏
|
||||
// @Description 获取当前登录用户收藏的材质列表
|
||||
// @Tags texture
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param page query int false "页码" default(1)
|
||||
// @Param page_size query int false "每页数量" default(20)
|
||||
// @Success 200 {object} model.Response{data=map[string]interface{}} "获取成功"
|
||||
// @Failure 500 {object} model.ErrorResponse "服务器错误"
|
||||
// @Router /api/v1/texture/favorites [get]
|
||||
func (h *TextureHandler) GetUserFavorites(c *gin.Context) {
|
||||
userID, ok := GetUserIDFromContext(c)
|
||||
if !ok {
|
||||
@@ -221,6 +299,21 @@ func (h *TextureHandler) GetUserFavorites(c *gin.Context) {
|
||||
}
|
||||
|
||||
// Upload 直接上传材质文件
|
||||
// @Summary 上传材质
|
||||
// @Description 上传图片文件创建新材质
|
||||
// @Tags texture
|
||||
// @Accept multipart/form-data
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param file formData file true "材质文件 (PNG)"
|
||||
// @Param name formData string true "材质名称"
|
||||
// @Param description formData string false "材质描述"
|
||||
// @Param type formData string false "材质类型 (SKIN/CAPE)" default(SKIN)
|
||||
// @Param is_public formData boolean false "是否公开" default(false)
|
||||
// @Param is_slim formData boolean false "是否为纤细模型 (仅SKIN有效)" default(false)
|
||||
// @Success 200 {object} model.Response{data=types.TextureInfo} "上传成功"
|
||||
// @Failure 400 {object} model.ErrorResponse "参数错误"
|
||||
// @Router /api/v1/texture/upload [post]
|
||||
func (h *TextureHandler) Upload(c *gin.Context) {
|
||||
userID, ok := GetUserIDFromContext(c)
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user