iedc-go/app/tag.go

44 lines
933 B
Go
Raw Normal View History

2022-10-30 15:44:05 +00:00
package app
import (
2022-10-30 17:18:19 +00:00
. "code.hoteas.com/golang/hotime"
. "code.hoteas.com/golang/hotime/common"
2022-10-30 15:44:05 +00:00
)
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)
},
}