修复bug

This commit is contained in:
hoteas 2021-09-25 04:36:07 +08:00
parent d1a8f6c668
commit deb3e54cc3
2 changed files with 6 additions and 6 deletions

View File

@ -9,22 +9,22 @@ var categoryCtr = Ctr{
"info": func(that *Context) { "info": func(that *Context) {
parentId := ObjToInt(that.Req.FormValue("id")) parentId := ObjToInt(that.Req.FormValue("id"))
//parentId := ObjToInt(that.RouterString[2]) //parentId := ObjToInt(that.RouterString[2])
childData:=[]Map{} childData := []Map{}
if parentId == 0 { if parentId == 0 {
childData1 := that.Db.Select("category", "*", Map{"parent_id": nil}) childData1 := that.Db.Select("category", "*", Map{"parent_id": nil})
for _, v := range childData1 { for _, v := range childData1 {
data := that.Db.Get("category", "*", Map{"parent_id": v.GetCeilInt("id")}) 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}) childData = that.Db.Select("category", "*", Map{"parent_id": parentId})
} }
for _, v := range childData { for _, v := range childData {
v["child"] = that.Db.Select("category", "*", Map{"parent_id": v.GetCeilInt("id")}) v["child"] = that.Db.Select("category", "*", Map{"parent_id": v.GetCeilInt("id")})
} }

Binary file not shown.