diff --git a/controller/blog.go b/controller/blog.go index f457d7d..1a5f971 100644 --- a/controller/blog.go +++ b/controller/blog.go @@ -17,6 +17,7 @@ import ( type DocTree struct{ ID int64 `json:"id"` Label string `json:"label"` + Level int `json:"level"` Children []*DocTree `json:"children"` } @@ -44,6 +45,7 @@ func InitDocCache(){ for _,v := range articles{ tmp := new (DocTree) tmp.ID = v.ID + tmp.Level = int(v.Level) tmp.Label = v.Title tmp.Children = make([]*DocTree,0) gDocMapCache[int(v.ID)] = tmp @@ -52,6 +54,7 @@ func InitDocCache(){ tmp := new (DocTree) tmp.ID = v.ID tmp.Label = v.Title + tmp.Level = int(v.Level) tmp.Children = make([]*DocTree,0) gDocMapCache[int(v.ID)] = tmp } @@ -487,6 +490,8 @@ func AddArticleTree(c *gin.Context) { rsp.Msg = "title required" return } + log.Print(req.Level) + e := model.CreateDocTree( model.DocTree{ Type: int32(req.Type),