Signed-off-by: 吴文峰 <kevin@lmve.net>
This commit is contained in:
2026-01-13 21:08:19 +08:00
parent 3acc19ffd8
commit 0b67a9bf09
16 changed files with 420 additions and 117 deletions
+25
View File
@@ -0,0 +1,25 @@
package routers
import (
"ops/models"
"path"
"github.com/gin-gonic/gin"
)
//处理api的静态内容
func ApiStatic(r *gin.RouterGroup) {
r.GET("/avatar/:filename", func(ctx *gin.Context) {
filename := ctx.Param("filename")
dst := path.Join(models.ConfigsFile.Pahts["avatar"], filename)
if models.FileExists(dst) {
ctx.File(dst)
} else {
//找不到文件
ctx.String(404, "file not found")
}
})
}