diff --git a/application/dto/request/request.go b/application/dto/request/request.go index f694ca8..025a2cb 100644 --- a/application/dto/request/request.go +++ b/application/dto/request/request.go @@ -7,10 +7,10 @@ package request // ListRequest 列表请求参数 type ListRequest struct { - Page int `form:"page" json:"page" query:"page" binding:"omitempty,min=1" msg:"页码最小为1" example:"1"` - PageSize int `form:"page_size" json:"page_size" query:"page_size" binding:"omitempty,min=1" msg:"每页数量最小为1" example:"10"` - Order string `form:"order" json:"order" query:"order" msg:"排序" example:"descend"` - Field string `form:"field" json:"field" query:"field" msg:"排序字段" example:"id"` + Page int `form:"page" json:"page" query:"page" binding:"omitempty,min=1" msg:"页码最小为1" ` + PageSize int `form:"page_size" json:"page_size" query:"page_size" binding:"omitempty,min=1" msg:"每页数量最小为1" ` + Order string `form:"order" json:"order" query:"order" msg:"排序" ` + Field string `form:"field" json:"field" query:"field" msg:"排序字段" ` } // ListResponse 列表响应参数 diff --git a/application/dto/response/response.go b/application/dto/response/response.go index 2f01d60..bb1e12f 100644 --- a/application/dto/response/response.go +++ b/application/dto/response/response.go @@ -20,8 +20,8 @@ const ( // ErrorModel 错误模型 type ErrorModel struct { - Code int `json:"code" example:"-1"` - Message string `json:"message" example:"操作失败"` + Code int `json:"code" ` + Message string `json:"message" ` Error interface{} `json:"result"` HttpStatus int `json:"httpStatus" swaggerignore:"true"` } @@ -33,17 +33,17 @@ const ( // Response 返回数据 type Response struct { - Code int `json:"code" example:"0"` + Code int `json:"code" ` Result interface{} `json:"result"` - Message string `json:"message" example:"操作成功"` + Message string `json:"message" ` } // PageList 分页数据 type PageList[T interface{}] struct { - Total int64 `json:"total" example:"100"` + Total int64 `json:"total" ` Data []T `json:"data" ` - Page int `json:"page" example:"1"` - PageSize int `json:"page_size" example:"10"` + Page int `json:"page" ` + PageSize int `json:"page_size" ` } // NewError 创建错误