hotime/example/app/tag.go
2022-02-24 06:26:36 +08:00

44 lines
895 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(t int) []Map {
//upCtg:=this.Db.Select("tag_ctg","*",Map{"parent_id":id})
//for _,v:=range upCtg{
upTag := this.Db.Select("tag", "*", Map{"AND": Map{"type": t, "org_id": 2}})
upTag1 := this.Db.Select("tag", "*", Map{"AND": Map{"type": t, "org_id": orgId}})
for _, v := range upTag {
check := true
for _, v1 := range upTag1 {
if v1.GetString("sn") == v.GetString("sn") {
check = false
break
}
}
if check {
upTag1 = append(upTag1, v)
}
}
return upTag1
}
data["upload"] = run(0)
data["api"] = run(1)
data["analyse"] = run(2)
this.Display(0, data)
},
}