iedc-go/example/app/tag.go

44 lines
895 B
Go
Raw Normal View History

2022-02-14 11:10:58 +00:00
package app
import (
. "../../../hotime"
. "../../common"
)
var tagCtr = Ctr{
"ctg_tree": func(this *Context) {
2022-02-23 22:26:36 +00:00
orgId := ObjToInt(this.Req.FormValue("org_id"))
if orgId == 0 {
this.Display(3, "参数错误")
return
}
2022-02-14 11:10:58 +00:00
data := Map{}
2022-02-19 13:38:17 +00:00
run := func(t int) []Map {
2022-02-14 11:10:58 +00:00
//upCtg:=this.Db.Select("tag_ctg","*",Map{"parent_id":id})
//for _,v:=range upCtg{
2022-02-23 22:26:36 +00:00
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
2022-02-14 11:10:58 +00:00
}
2022-02-19 13:38:17 +00:00
2022-02-23 22:26:36 +00:00
data["upload"] = run(0)
data["api"] = run(1)
data["analyse"] = run(2)
2022-02-14 11:10:58 +00:00
this.Display(0, data)
},
}