增加表关联新建功能,同时修复数据库bug
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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)
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user