You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
644 B
34 lines
644 B
package utils
|
|
|
|
type ResCode int64
|
|
|
|
const (
|
|
CodeSuccess ResCode = 1000 + iota
|
|
CodeInvalidParam
|
|
CodeUpLoadError
|
|
CodeStudentInfoEmpty
|
|
CodeWriteInfoError
|
|
CodeTooMuchNum
|
|
|
|
CodeServerBusy
|
|
)
|
|
|
|
var codeMsgMap = map[ResCode]string{
|
|
CodeSuccess: "success",
|
|
CodeInvalidParam: "请求参数错误",
|
|
CodeUpLoadError: "上传文件错误",
|
|
CodeStudentInfoEmpty: "学生信息为空",
|
|
CodeWriteInfoError: "写入信息错误",
|
|
CodeTooMuchNum: "请求数量过多",
|
|
|
|
CodeServerBusy: "服务繁忙",
|
|
}
|
|
|
|
func (c ResCode) Msg() string {
|
|
msg, ok := codeMsgMap[c]
|
|
if !ok {
|
|
msg = codeMsgMap[CodeServerBusy]
|
|
}
|
|
return msg
|
|
}
|