forked from golang/hotime
25 lines
505 B
Go
25 lines
505 B
Go
|
package app
|
||
|
|
||
|
import (
|
||
|
. "../../../hotime"
|
||
|
. "../../../hotime/common"
|
||
|
)
|
||
|
|
||
|
var categoryCtr = Ctr{
|
||
|
"info": func(that *Context) {
|
||
|
//parentId:=ObjToInt(that.Req.FormValue("parent_id"))
|
||
|
parentId := ObjToInt(that.RouterString[2])
|
||
|
if parentId == 0 {
|
||
|
parentId = 1
|
||
|
}
|
||
|
|
||
|
childData := that.Db.Select("category", "*", Map{"parent_id": parentId})
|
||
|
|
||
|
for _, v := range childData {
|
||
|
v["child"] = that.Db.Select("category", "*", Map{"parent_id": v.GetCeilInt("id")})
|
||
|
}
|
||
|
|
||
|
that.Display(0, childData)
|
||
|
},
|
||
|
}
|