商品管理ui优化, 后台支持分页参数

This commit is contained in:
yml
2026-06-01 00:56:45 +08:00
parent 4437c3b439
commit aff108fc96
7 changed files with 503 additions and 73 deletions
+18 -2
View File
@@ -95,12 +95,12 @@ func (h *Handler) ListAdmin(c *gin.Context) {
if !ok {
return
}
items, err := h.service.ListAdmin(query)
result, err := h.service.ListAdmin(query)
if err != nil {
writeListingError(c, err)
return
}
response.OK(c, gin.H{"items": items})
response.OK(c, result)
}
func (h *Handler) FindAdmin(c *gin.Context) {
@@ -347,6 +347,22 @@ func parseAdminListQuery(c *gin.Context) (AdminListQuery, bool) {
}
query.Limit = value
}
if raw := c.Query("page"); raw != "" {
value, err := strconv.Atoi(raw)
if err != nil || value <= 0 {
response.BadRequest(c, "页码不正确")
return query, false
}
query.Page = value
}
if raw := c.Query("page_size"); raw != "" {
value, err := strconv.Atoi(raw)
if err != nil || value <= 0 {
response.BadRequest(c, "每页条数不正确")
return query, false
}
query.PageSize = value
}
query.Status = c.Query("status")
query.ReviewStatus = c.Query("review_status")
return query, true