26 lines
629 B
Go
26 lines
629 B
Go
|
package app
|
||
|
|
||
|
type Response struct {
|
||
|
Code int `json:"code" example:"200"` // 代码
|
||
|
Data interface{} `json:"data"` // 数据集
|
||
|
Msg string `json:"msg"` // 消息
|
||
|
RequestId string `json:"requestId"` // 请求id
|
||
|
}
|
||
|
|
||
|
type Page struct {
|
||
|
List interface{} `json:"list"`
|
||
|
Count int `json:"count"`
|
||
|
PageIndex int `json:"pageIndex"`
|
||
|
PageSize int `json:"pageSize"`
|
||
|
}
|
||
|
|
||
|
func (res *Response) ReturnOK() *Response {
|
||
|
res.Code = 200
|
||
|
return res
|
||
|
}
|
||
|
|
||
|
func (res *Response) ReturnError(code int) *Response {
|
||
|
res.Code = code
|
||
|
return res
|
||
|
}
|