base.go
491 字节
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 {
return fmt.Sprintf("HttpError code:%d msg:%s", e.Base.Code, e.Base.Msg)
}