提交 3c815f98 authored 作者: mooncake9527's avatar mooncake9527

update

上级 aecf6594
...@@ -26,7 +26,7 @@ type BasePageReply struct { ...@@ -26,7 +26,7 @@ type BasePageReply struct {
Total int64 `json:"total" comment:"total" encomment:"total" form:"total" example:"2000"` // 总行数 Total int64 `json:"total" comment:"total" encomment:"total" form:"total" example:"2000"` // 总行数
PageSize int64 `json:"pageSize" comment:"pageSize" encomment:"pageSize" form:"pageSize" example:"1"` // 页大小 PageSize int64 `json:"pageSize" comment:"pageSize" encomment:"pageSize" form:"pageSize" example:"1"` // 页大小
PageIndex int64 `json:"pageIndex" comment:"pageIndex" encomment:"pageIndex" form:"pageIndex" example:"1"` // 当前页码 PageIndex int64 `json:"pageIndex" comment:"pageIndex" encomment:"pageIndex" form:"pageIndex" example:"1"` // 当前页码
PageCount int64 `json:"pageCount" comment:"pageCount" encomment:"pageCount" form:"pageCount" example:"99"` // 总页数 PageTotal int64 `json:"pageTotal" comment:"pageTotal" encomment:"pageTotal" form:"pageTotal" example:"99"` // 总页数
} }
type BaseListReply struct { type BaseListReply struct {
...@@ -217,16 +217,16 @@ func SuccessWithPage[T any](c *gin.Context, list []*T, total int64) { ...@@ -217,16 +217,16 @@ func SuccessWithPage[T any](c *gin.Context, list []*T, total int64) {
} }
} }
} }
pageCount := total / int64(pageSize) pageTotal := total / int64(pageSize)
if total%int64(pageSize) > 0 { if total%int64(pageSize) > 0 {
pageCount = pageCount + 1 pageTotal = pageTotal + 1
} }
c.Set(ctxUtils.KeyRspCode, 1) c.Set(ctxUtils.KeyRspCode, 1)
if list == nil { if list == nil {
list = []*T{} list = []*T{}
} }
respJSONWith200(c, errcode.Success.Code(), errcode.Success.Msg(), gin.H{ respJSONWith200(c, errcode.Success.Code(), errcode.Success.Msg(), gin.H{
"list": list, "total": total, "pageIndex": pageIndex, "pageCount": pageCount, "pageSize": pageSize, "list": list, "total": total, "pageIndex": pageIndex, "pageTotal": pageTotal, "pageSize": pageSize,
}) })
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论