1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| package code
|
| import "net/http"
|
| // Code 错误输出数据结构
| type Code struct {
| Status int `json:"status"` // HTTP 状态
| Success bool `json:"success"` // 成功或者失败
| Message string `json:"msg"` // 描述信息
| }
|
| var (
| // Success 请求处理成功
| Success = &Code{http.StatusOK, true, "请求处理成功"}
| // RequestParamError 请求参数错误
| RequestParamError = &Code{http.StatusBadRequest, false, "请求参数有误"}
| )
|
|