package resutil import ( "gokratos-base/common/errorx" ) type HttpResponse struct { Code int `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data,omitempty"` } func MakeHttpSuccess(data interface{}) (r *HttpResponse) { r = &HttpResponse{ Code: 1, Msg: "ok", Data: data, } return } func MakeHttpError(err error) (r *HttpResponse) { r = &HttpResponse{} r.Code, r.Msg = errorx.ParseError(err) return }