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 } // MiGuErrorResponse 响应结构体,code 为字符串类型 type MiGuErrorResponse struct { Code string `json:"code" example:"200"` // 字符串类型的代码 Data interface{} `json:"data"` // 数据集 Msg string `json:"message"` // 消息 RequestId string `json:"requestId"` // 请求id }