-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.go
More file actions
40 lines (33 loc) · 874 Bytes
/
code.go
File metadata and controls
40 lines (33 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package core
type CodeMapping map[string]string
func (cm CodeMapping) GetCodeInfo(code string) string {
if v, ok := cm[code]; ok {
return v
}
return ""
}
func (cm CodeMapping) AddCodeInfo(code, msg string) {
cm[code] = msg
}
const (
SuccessCode = "000000"
FailCode = "500"
FailUnknownCode = "-1"
FailJsonParse = "-2"
FailThirdLogin = "-3"
FailSecret = "-4"
FailParamsError = "-5"
FailPostMax = "-6"
FailInternal = "400"
)
var DefaultCodeMapping = CodeMapping{
FailCode: "操作失败",
FailUnknownCode: "未知接口",
FailJsonParse: "JSON解析错误或者接口不存在",
FailThirdLogin: "第三方登录异常",
FailSecret: "加密参数错误",
SuccessCode: "操作成功",
FailInternal: "内部错误",
FailParamsError: "参数不合法",
FailPostMax: "数据超过限制的大小",
}