diff --git a/example/app/category.go b/example/app/category.go index dba7256..627e1ea 100644 --- a/example/app/category.go +++ b/example/app/category.go @@ -9,22 +9,22 @@ var categoryCtr = Ctr{ "info": func(that *Context) { parentId := ObjToInt(that.Req.FormValue("id")) //parentId := ObjToInt(that.RouterString[2]) - childData:=[]Map{} + childData := []Map{} if parentId == 0 { childData1 := that.Db.Select("category", "*", Map{"parent_id": nil}) for _, v := range childData1 { data := that.Db.Get("category", "*", Map{"parent_id": v.GetCeilInt("id")}) - childData=append(childData,data) + if data != nil { + childData = append(childData, data) + } + } - - }else{ + } else { childData = that.Db.Select("category", "*", Map{"parent_id": parentId}) } - - for _, v := range childData { v["child"] = that.Db.Select("category", "*", Map{"parent_id": v.GetCeilInt("id")}) } diff --git a/example/bzyy.exe b/example/bzyy.exe index 5620a3f..3172af2 100644 Binary files a/example/bzyy.exe and b/example/bzyy.exe differ