base.go 556 字节
package gateway

import (
	"encoding/json"
	"fmt"
)

// Response 统一消息返回格式
type Response struct {
	Code int             `json:"code,optional"`
	Msg  string          `json:"msg,optional"`
	Data json.RawMessage `json:"data,optional"`
}

//
//type Request struct {
//	Url    string
//	Method string
//	Param  interface{}
//}

type HttpError struct {
	Base Response
}

func (e HttpError) Error() string {
	if e.Base.Code > 0 && e.Base.Msg != "" {
		return e.Base.Msg
	}
	return fmt.Sprintf("HttpError code:%d msg:%s", e.Base.Code, e.Base.Msg)
}