书写前端接口

This commit is contained in:
hoteas
2021-12-12 04:22:30 +08:00
parent 7b85da4c7f
commit 9482404265
5 changed files with 77 additions and 17 deletions
+13 -4
View File
@@ -98,20 +98,29 @@ var product_spot_checkCtr = Ctr{
}
page := ObjToInt(that.Req.FormValue("page"))
pageSize := ObjToInt(that.Req.FormValue("pageSize"))
productId := ObjToInt(that.Req.FormValue("id"))
if page < 1 {
page = 1
}
if pageSize <= 0 {
pageSize = 20
pageSize = 10
}
columnStr := "sn,product.name,img,count,saved,admin_id,admin.name AS admin_name,modify_time,state"
columnStr := "product_spot_check.id,product_spot_check.product_id,product_spot_check.sn,product.name,product_spot_check.img,product_spot_check.admin_id,admin.name AS admin_name,product_spot_check.modify_time,product_spot_check.state"
leftJoin := Map{"[><]product": "product_spot_check.product_id=product.id",
"[><]admin": "product_spot_check.admin_id=admin.id",
}
where := Map{"ORDER": "modify_time DESC"}
count := that.Db.Count("product_spot_check", "id", where)
where := Map{"ORDER": "id DESC"}
if productId != 0 {
where["product_id"] = productId
}
count := that.Db.Count("product_spot_check", where)
reData := that.Db.Page(page, pageSize).
PageSelect("product_spot_check", leftJoin, columnStr, where)