🐝 reformat code

This commit is contained in:
微凉
2021-03-05 21:25:44 +08:00
parent d137ef8759
commit 3138e031f5
28 changed files with 389 additions and 389 deletions

View File

@ -13,30 +13,30 @@ func Info(c *gin.Context) {
// handle refresh_cache request
func RefreshCache(c *gin.Context) {
password:=c.Param("password")
password := c.Param("password")
if conf.Conf.Cache.Enable {
if password == conf.Conf.Cache.RefreshPassword {
conf.Cache.Flush()
c.JSON(200, MetaResponse(200,"flush success."))
c.JSON(200, MetaResponse(200, "flush success."))
return
}
c.JSON(200, MetaResponse(401,"wrong password."))
c.JSON(200, MetaResponse(401, "wrong password."))
return
}
c.JSON(200, MetaResponse(400,"disabled cache."))
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()))
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()))
if err := models.BuildTree(); err != nil {
c.JSON(200, MetaResponse(500, err.Error()))
return
}
c.JSON(200,MetaResponse(200,"success."))
c.JSON(200, MetaResponse(200, "success."))
return
}
}