提交 b2850763 编写于 作者: Mr.奇淼('s avatar Mr.奇淼(

统一分页回传结构体

上级 bc7d89cc
......@@ -86,7 +86,7 @@ func GetExaCustomer(c *gin.Context) {
if err != nil {
response.FailWithMessage(fmt.Sprintf("获取失败:%v", err), c)
} else {
response.OkWithData( resp.ExaCustomerResponse{Customer: customer}, c)
response.OkWithData(resp.ExaCustomerResponse{Customer: customer}, c)
}
}
......@@ -107,11 +107,11 @@ func GetExaCustomerList(c *gin.Context) {
if err != nil {
response.FailWithMessage(fmt.Sprintf("创建失败:%v", err), c)
} else {
response.Result(response.SUCCESS, gin.H{
"customer": customerList,
"total": total,
"page": pageInfo.Page,
"pageSize": pageInfo.PageSize,
}, "创建成功", c)
response.OkWithData(resp.PageResult{
List: customerList,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, c)
}
}
......@@ -95,11 +95,11 @@ func GetFileList(c *gin.Context) {
if err != nil {
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
} else {
response.OkDetailed(gin.H{
"list": list,
"total": total,
"page": pageInfo.Page,
"pageSize": pageInfo.PageSize,
}, "获取数据成功", c)
response.OkWithData(resp.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, c)
}
}
......@@ -66,12 +66,12 @@ func GetApiList(c *gin.Context) {
if err != nil {
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
} else {
response.OkDetailed(gin.H{
"list": list,
"total": total,
"page": sp.PageInfo.Page,
"pageSize": sp.PageInfo.PageSize,
}, "删除成功", c)
response.OkWithData(resp.PageResult{
List: list,
Total: total,
Page: sp.PageInfo.Page,
PageSize: sp.PageInfo.PageSize,
}, c)
}
}
......
......@@ -64,12 +64,12 @@ func GetAuthorityList(c *gin.Context) {
if err != nil {
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
} else {
response.OkDetailed(gin.H{
"list": list,
"total": total,
"page": pageInfo.Page,
"pageSize": pageInfo.PageSize,
}, "获取数据成功", c)
response.OkWithData(resp.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, c)
}
}
......
......@@ -43,12 +43,12 @@ func GetMenuList(c *gin.Context) {
if err != nil {
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
} else {
response.OkDetailed(gin.H{
"list": menuList,
"total": total,
"page": pageInfo.Page,
"pageSize": pageInfo.PageSize,
}, "获取数据成功", c)
response.OkWithData(resp.PageResult{
List: menuList,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, c)
}
}
......
......@@ -202,12 +202,12 @@ func GetUserList(c *gin.Context) {
if err != nil {
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
} else {
response.OkDetailed(gin.H{
"userList": list,
"total": total,
"page": pageInfo.Page,
"pageSize": pageInfo.PageSize,
}, "获取数据成功", c)
response.OkWithData(resp.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, c)
}
}
......
package response
type PageResult struct {
List interface{} `json:"list"`
Total int `json:"total"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
}
......@@ -137,7 +137,6 @@ export default {
data() {
return {
listApi: getApiList,
listKey: 'list',
dialogFormVisible: false,
form: {
path: '',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册