viper-app/api/response/response.go

26 lines
470 B
Go

package response
type Response struct {
// 状态码
// * 0 SUCCESS
// * 2 WARN 警告
// * 5 INPUT_ERROR 输入错误
// * 7 ERROR 执行错误
Code int `json:"code"`
Msg string `json:"msg"` // 返回信息
Data any `json:"data"` // 返回数据
}
const (
SUCCESS = 0
WARN = 2
INPUT_ERROR = 5
ERROR = 7
)
const (
MsgSuccess = "success. "
MsgError = "server internal error. "
MsgInputError = "client require error. "
)