-
Notifications
You must be signed in to change notification settings - Fork 0
/
resp_code000.go
129 lines (104 loc) · 3.48 KB
/
resp_code000.go
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package respx
import "encoding/json"
// errcode 000_00~99
const (
ERR000_01 errcode = "00001" //通用错误
ERR000_01_MSG errmsg = "网络错误,请稍后重试!" //通用错误
ERR000_02 errcode = "00002" //无操作权限
ERR000_02_MSG errmsg = "无操作权限" //无操作权限
ERR000_03 errcode = "00003" //请求格式不正确
ERR000_03_MSG errmsg = "请求格式不正确" //请求格式不正确
ERR000_04 errcode = "00004" //无访问权限
ERR000_04_MSG errmsg = "无访问权限" //无访问权限
ERR000_05 errcode = "00005" //请登录后操作
ERR000_05_MSG errmsg = "请登录后操作" //请登录后操作
ERR000_06 errcode = "00006" //请求类型未定义
ERR000_06_MSG errmsg = "请求类型未定义" //请求类型未定义
ERR000_07 errcode = "00007" //令牌过期
ERR000_07_MSG errmsg = "令牌过期" //令牌过期
ERR000_08 errcode = "00008" //帐号已在别处登陆
ERR000_08_MSG errmsg = "帐号已在别处登陆" //帐号已在别处登陆
ERR000_09 errcode = "00009" //权限被修改请重新登录
ERR000_09_MSG errmsg = "权限被修改请重新登录" //权限被修改请重新登录
)
//00001
func Resp00001Byte() []byte {
respjson, _ := json.Marshal(RespCode{Errcode: ERR000_01, Errmsg: ERR000_01_MSG})
return respjson
}
func Resp00001() string {
respjson, _ := json.Marshal(RespCode{Errcode: ERR000_01, Errmsg: ERR000_01_MSG})
return string(respjson)
}
func Resp00001MsgByte(msg string) string {
respjson, _ := json.Marshal(RespCode{Errcode: ERR000_01, Errmsg: Errmsg(msg)})
return string(respjson)
}
func Resp00001Msg(msg string) string {
respjson, _ := json.Marshal(RespCode{Errcode: ERR000_01, Errmsg: Errmsg(msg)})
return string(respjson)
}
//00002
func Resp00002() string {
respjson, _ := json.Marshal(RespCode{Errcode: ERR000_02, Errmsg: ERR000_02_MSG})
return string(respjson)
}
//00003
func Resp00003() string {
respjson, _ := json.Marshal(RespCode{Errcode: ERR000_03, Errmsg: ERR000_03_MSG})
return string(respjson)
}
//00004
func Resp00004Byte() []byte {
respjson, _ := json.Marshal(RespCode{Errcode: ERR000_04, Errmsg: ERR000_04_MSG})
return respjson
}
func Resp00004() string {
respjson, _ := json.Marshal(RespCode{Errcode: ERR000_04, Errmsg: ERR000_04_MSG})
return string(respjson)
}
//00005
func Resp00005Byte(msgs ...string) []byte {
p := RespCode{Errcode: ERR000_05, Errmsg: ERR000_05_MSG}
if len(msgs) > 0 {
pErrmsg := ""
for _, v := range msgs {
if len(v) == 0 {
continue
}
pErrmsg += v + ","
}
pErrmsg += ERR000_05_MSG.Str()
p.Errmsg = Errmsg(pErrmsg)
}
respjson, _ := json.Marshal(p)
return respjson
}
func Resp00005() string {
respjson, _ := json.Marshal(RespCode{Errcode: ERR000_05, Errmsg: ERR000_05_MSG})
return string(respjson)
}
//00006
func Resp00006() string {
respjson, _ := json.Marshal(RespCode{Errcode: ERR000_06, Errmsg: ERR000_06_MSG})
return string(respjson)
}
//00007
func Resp00007Byte() []byte {
respjson, _ := json.Marshal(RespCode{Errcode: ERR000_07, Errmsg: ERR000_07_MSG})
return respjson
}
func Resp00007() string {
respjson, _ := json.Marshal(RespCode{Errcode: ERR000_07, Errmsg: ERR000_07_MSG})
return string(respjson)
}
//00008
func Resp00008() string {
respjson, _ := json.Marshal(RespCode{Errcode: ERR000_08, Errmsg: ERR000_08_MSG})
return string(respjson)
}
//00009
func Resp00009() string {
respjson, _ := json.Marshal(RespCode{Errcode: ERR000_09, Errmsg: ERR000_09_MSG})
return string(respjson)
}