// http_result package utils import "encoding/json" type HttpResult struct { Code int8 Msg string Data interface{} } func BuildSuccess() (string) { httpResult := new(HttpResult) httpResult.Code = 0 httpResultByte,_ :=json.Marshal(httpResult) return string(httpResultByte) } func BuildFail(msg string) (string) { httpResult := new(HttpResult) httpResult.Code = -1 httpResult.Msg = msg httpResultByte,_ :=json.Marshal(httpResult) return string(httpResultByte) } func BuildSuccessData(data interface{}) (string) { httpResult := new(HttpResult) httpResult.Code = 0 httpResult.Data = data httpResultByte,_ :=json.Marshal(httpResult) return string(httpResultByte)}