feat: add module resp
This commit is contained in:
34
resp/msg.go
Normal file
34
resp/msg.go
Normal file
@ -0,0 +1,34 @@
|
||||
package resp
|
||||
|
||||
const (
|
||||
Msg200 = "操作成功"
|
||||
Msg400 = "参数错误"
|
||||
Msg401 = "登录信息不存在或已过期, 请重新登录"
|
||||
Msg401NoMulti = "用户已在其他地方登录"
|
||||
Msg403 = "权限不足"
|
||||
Msg404 = "资源不存在"
|
||||
Msg500 = "服务器开小差了"
|
||||
Msg501 = "服务不可用"
|
||||
Msg503 = "服务不可用或正在升级, 请联系管理员"
|
||||
)
|
||||
|
||||
func Msg(status int) string {
|
||||
switch status {
|
||||
case 400:
|
||||
return Msg400
|
||||
case 401:
|
||||
return Msg401
|
||||
case 403:
|
||||
return Msg403
|
||||
case 404:
|
||||
return Msg404
|
||||
case 500:
|
||||
return Msg500
|
||||
case 501:
|
||||
return Msg501
|
||||
case 503:
|
||||
return Msg503
|
||||
}
|
||||
|
||||
return "未知错误"
|
||||
}
|
Reference in New Issue
Block a user