mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Feat: add and delete file tags
This commit is contained in:
@@ -27,7 +27,7 @@ func SiteConfig(c *gin.Context) {
|
||||
"share_view_method",
|
||||
)
|
||||
|
||||
// 如果已登录,则同时返回用户信息
|
||||
// 如果已登录,则同时返回用户信息和标签
|
||||
user, _ := c.Get("user")
|
||||
if user, ok := user.(*model.User); ok {
|
||||
c.JSON(200, serializer.BuildSiteConfig(siteConfig, user))
|
||||
|
||||
39
routers/controllers/tag.go
Normal file
39
routers/controllers/tag.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/HFO4/cloudreve/service/explorer"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// CreateFilterTag 创建文件分类标签
|
||||
func CreateFilterTag(c *gin.Context) {
|
||||
var service explorer.FilterTagCreateService
|
||||
if err := c.ShouldBindJSON(&service); err == nil {
|
||||
res := service.Create(c, CurrentUser(c))
|
||||
c.JSON(200, res)
|
||||
} else {
|
||||
c.JSON(200, ErrorResponse(err))
|
||||
}
|
||||
}
|
||||
|
||||
// CreateLinkTag 创建目录快捷方式标签
|
||||
func CreateLinkTag(c *gin.Context) {
|
||||
var service explorer.LinkTagCreateService
|
||||
if err := c.ShouldBindJSON(&service); err == nil {
|
||||
res := service.Create(c, CurrentUser(c))
|
||||
c.JSON(200, res)
|
||||
} else {
|
||||
c.JSON(200, ErrorResponse(err))
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteTag 删除标签
|
||||
func DeleteTag(c *gin.Context) {
|
||||
var service explorer.TagService
|
||||
if err := c.ShouldBindUri(&service); err == nil {
|
||||
res := service.Delete(c, CurrentUser(c))
|
||||
c.JSON(200, res)
|
||||
} else {
|
||||
c.JSON(200, ErrorResponse(err))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user