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
| package status
const ( OK = 0 UnknowError = 100 UserNotExist = 101 UserExist = 102 CodeNoExist = 103 CodeError = 104 UserError = 105 InnerError = 199 )
var statusText = map[int]string{ OK: "", UnknowError: "未知错误", UserNotExist: "用户不存在", UserExist: "用户名已被注册", CodeNoExist: "验证码不存在或已过期,请重新获取验证码", CodeError: "验证码不正确", UserError: "用户名或密码错误", InnerError: "内部错误: ", }
func Message(code int) string { str, ok := statusText[code] if ok { return str } return statusText[UnknowError] }
|