hotime/example/app/tag.go
2022-02-14 19:10:58 +08:00

37 lines
788 B
Go

package app
import (
. "../../../hotime"
. "../../common"
)
var tagCtr = Ctr{
"ctg_tree": func(this *Context) {
//orgId := ObjToInt(this.Req.FormValue("org_id"))
//if orgId == 0 {
// this.Display(3, "参数错误")
// return
//}
data := Map{}
run := func(id int) []Map {
//upCtg:=this.Db.Select("tag_ctg","*",Map{"parent_id":id})
//for _,v:=range upCtg{
upTag := this.Db.Select("tag", "*", Map{"tag_ctg_id": id})
//v["tag"]=upTag
//}
return upTag
}
upCtg := this.Db.Select("tag_ctg", "*", Map{"parent_id": 1})
for _, v := range upCtg {
upTag := this.Db.Select("tag", "*", Map{"tag_ctg_id": v.GetCeilInt("id")})
v["tag"] = upTag
}
data["upload"] = upCtg
data["api"] = run(2)
data["analyse"] = run(3)
this.Display(0, data)
},
}