migu_music_server/tools/app/model.go
2025-03-28 14:07:20 +08:00

34 lines
994 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
}