🚧 构建目录树

This commit is contained in:
微凉
2021-03-05 21:07:45 +08:00
parent 389226662c
commit d137ef8759
11 changed files with 238 additions and 53 deletions

View File

@ -2,6 +2,7 @@ package controllers
import (
"github.com/Xhofe/alist/conf"
"github.com/Xhofe/alist/server/models"
"github.com/gin-gonic/gin"
)
@ -24,4 +25,18 @@ func RefreshCache(c *gin.Context) {
}
c.JSON(200, MetaResponse(400,"disabled cache."))
return
}
// rebuild tree
func RebuildTree(c *gin.Context) {
if err:=models.Clear();err!=nil{
c.JSON(200,MetaResponse(500,err.Error()))
return
}
if err:=models.BuildTree();err!=nil {
c.JSON(200,MetaResponse(500,err.Error()))
return
}
c.JSON(200,MetaResponse(200,"success."))
return
}