package app type Response struct { Code int `json:"code"` Message string `json:"message"` // 数据集 Data interface{} `json:"data"` } type AliResponse struct { Code int `json:"code"` Message string `json:"message"` // 数据集 Data interface{} `json:"data"` } type ApiBaseOutputHead struct { Code int `json:"code" example:"200"` Msg string `json:"msg"` } type Page struct { List interface{} `json:"rows"` Count int `json:"count"` PageIndex int `json:"pageIndex"` PageSize int `json:"pageSize"` } type PageResponse struct { ApiBaseOutputHead ApiBaseOutputHead `json:"apiBaseOutputHead"` //Data interface{} `json:"data"` // 代码 //Code int `json:"code" example:"200"` // 数据集 Data Page `json:"data"` // 消息 //Msg string `json:"msg"` } type PageRes struct { // 代码 Code int `json:"code"` // 数据集 Data Page `json:"data"` // 消息 Msg string `json:"message"` } func (res *Response) ReturnOK() *Response { res.Code = 200 return res } func (res *Response) ReturnError(code int) *Response { res.Code = code return res } func (res *PageResponse) ReturnOK() *PageResponse { res.ApiBaseOutputHead.Code = 200 return res }