增加表关联新建功能,同时修复数据库bug
This commit is contained in:
@@ -41,6 +41,7 @@ var orderCtr = Ctr{
|
||||
"category_id": ctgOrderDate.GetCeilInt("category_id"),
|
||||
"admin_id": 1,
|
||||
"status": 1,
|
||||
"name": time.Unix(ctgOrderDate.GetCeilInt64("date"), 0).Format("2006-01-02 ") + ctgOrderDate.GetString("name"),
|
||||
}
|
||||
|
||||
data["id"] = this.Db.Insert("order", data)
|
||||
@@ -59,8 +60,11 @@ var orderCtr = Ctr{
|
||||
return
|
||||
}
|
||||
|
||||
data := that.Db.Select("order", Map{"[><]user": "order.user_id=user.id",
|
||||
"[><]category": "order.category_id=category.id"}, "*", Map{"user_id": that.Session("id").ToCeilInt()})
|
||||
data := that.Db.Select("order", "*", Map{"user_id": that.Session("id").ToCeilInt()})
|
||||
for _, v := range data {
|
||||
v["category"] = that.Db.Get("category", "*", Map{"id": v.GetCeilInt("category_id")})
|
||||
v["parent_category"] = that.Db.Get("category", "id,name", Map{"id": v.GetMap("category").GetCeilInt("parent_id")})
|
||||
}
|
||||
that.Display(0, data)
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user