package serializer import "net/http" type Response struct { Code int32 `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` } /* 自定义错误码 10000 用户操作 */ const ( ErrNoUser = 10001 ) func Success(data interface{}) Response { r := Response{ Code: http.StatusOK, Msg: "", Data: data, } return r }