mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-12-27 18:06:37 +08:00
feat: 新增统一文件模块,统一文件操作
This commit is contained in:
29
server/internal/file/router/file.go
Normal file
29
server/internal/file/router/file.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"mayfly-go/internal/file/api"
|
||||
"mayfly-go/pkg/biz"
|
||||
"mayfly-go/pkg/ioc"
|
||||
"mayfly-go/pkg/req"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func InitFileRouter(router *gin.RouterGroup) {
|
||||
file := router.Group("sys/files")
|
||||
f := new(api.File)
|
||||
biz.ErrIsNil(ioc.Inject(f))
|
||||
|
||||
reqs := [...]*req.Conf{
|
||||
|
||||
req.NewGet("/detail/:keys", f.GetFileByKeys).DontNeedToken(),
|
||||
|
||||
req.NewGet("/:key", f.GetFileContent).DontNeedToken().NoRes(),
|
||||
|
||||
req.NewPost("/upload", f.Upload).Log(req.NewLogSave("file-文件上传")),
|
||||
|
||||
req.NewDelete("/:key", f.Remove).Log(req.NewLogSave("file-文件删除")),
|
||||
}
|
||||
|
||||
req.BatchSetGroup(file, reqs[:])
|
||||
}
|
||||
Reference in New Issue
Block a user