增加表关联新建功能,同时修复数据库bug

This commit is contained in:
2021-08-29 06:08:19 +08:00
parent b480659a22
commit e1f4876621
6 changed files with 26 additions and 9 deletions
+6 -2
View File
@@ -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)
},
}