Documentation ¶
Index ¶
Constants ¶
View Source
const ( // 0-999 reserved CodeSuccess = 0 CodeFailed = 1 CodeSystem = 2 CodeInvalidToken = 401 // token无效 CodeNotFound = 404 // 未找到相关资源 // params CodeParamInvalid = 10001 // 参数错误 CodeParamRequired = 10002 // 缺少必传参数 // auth CodeAuthBadSignature = 10101 // 签名错误 CodeAuthInvalidUserOrPswd = 10102 // 用户名或密码错误 CodeAuthPermissionDenied = 10103 // 无权限 CodeAuthNotFoundUser = 10104 // 没有找到用户 CodeIdentityNotFound = 10105 // 没有找到用户身份 CodeRealNameVerifyRepeat = 10201 // 已实名,不能重复申请认证 CodeVerifyCode = 10202 // 验证码验证失败 CodeVerifyCodeRate = 10203 // 验证码请求太频繁 CodeIdentityRepeat = 10204 // 用户身份标识重复 CodeNicknameRepeat = 10205 // 用户昵称重复 CodeReferralCode = 10206 // 邀请码错误 )
Variables ¶
View Source
var ( ErrSystem = NewError(CodeSystem, GetMessage(CodeSystem)) ErrFailed = NewError(CodeFailed, GetMessage(CodeFailed)) ErrNotFound = NewError(CodeNotFound, GetMessage(CodeNotFound)) ErrInvalidToken = NewError(CodeInvalidToken, GetMessage(CodeInvalidToken)) // params ErrParamInvalid = NewError(CodeParamInvalid, GetMessage(CodeParamInvalid)) ErrParamRequired = NewError(CodeParamRequired, GetMessage(CodeParamRequired)) // auth ErrAuthBadSignature = NewError(CodeAuthBadSignature, GetMessage(CodeAuthBadSignature)) ErrAuthInvalidUserOrPswd = NewError(CodeAuthInvalidUserOrPswd, GetMessage(CodeAuthInvalidUserOrPswd)) ErrAuthPermissionDenied = NewError(CodeAuthPermissionDenied, GetMessage(CodeAuthPermissionDenied)) ErrAuthNotFoundUser = NewError(CodeAuthNotFoundUser, GetMessage(CodeAuthNotFoundUser)) ErrIdentityNotFound = NewError(CodeIdentityNotFound, GetMessage(CodeIdentityNotFound)) ErrRealNameVerifyRepeat = NewError(CodeRealNameVerifyRepeat, GetMessage(CodeRealNameVerifyRepeat)) ErrVerifyCode = NewError(CodeVerifyCode, GetMessage(CodeVerifyCode)) ErrVerifyCodeRate = NewError(CodeVerifyCodeRate, GetMessage(CodeVerifyCodeRate)) ErrIdentityRepeat = NewError(CodeIdentityRepeat, GetMessage(CodeIdentityRepeat)) ErrNicknameRepeat = NewError(CodeNicknameRepeat, GetMessage(CodeNicknameRepeat)) ErrReferralCode = NewError(CodeReferralCode, GetMessage(CodeReferralCode)) )
View Source
var Messages = map[int]string{ CodeSuccess: "success", CodeFailed: "failed", CodeSystem: "system error", CodeInvalidToken: "token invalid", CodeNotFound: "not found", CodeParamInvalid: "param invalid", CodeParamRequired: "param require", CodeAuthBadSignature: "bad signature", CodeAuthInvalidUserOrPswd: "invalid user or password", CodeAuthPermissionDenied: "permission denied", CodeAuthNotFoundUser: "not found user", CodeIdentityNotFound: "not found identity", CodeRealNameVerifyRepeat: "realname verify repeat", CodeVerifyCode: "invalid verification code", CodeVerifyCodeRate: "verification code request too often", CodeIdentityRepeat: "identity registered", CodeNicknameRepeat: "nickname registered", CodeReferralCode: "invalid referral code", }
View Source
var MessagesCN = map[int]string{ CodeSuccess: "处理成功", CodeFailed: "处理失败", CodeSystem: "系统错误", CodeInvalidToken: "token无效", CodeNotFound: "未找到对应资源", CodeParamInvalid: "参数无效或格式错误", CodeParamRequired: "缺少必要参数", CodeAuthBadSignature: "签名错误", CodeAuthInvalidUserOrPswd: "用户名或密码错误", CodeAuthPermissionDenied: "无权限", CodeAuthNotFoundUser: "用户不存在", CodeIdentityNotFound: "用户身份信息不存在", CodeRealNameVerifyRepeat: "已实名认证,不可再次提交申请", CodeVerifyCode: "验证码不存在或者无效", CodeVerifyCodeRate: "验证码请求太频繁,明日再试", CodeIdentityRepeat: "用户身份标识(手机号或者邮箱)已注册", CodeNicknameRepeat: "用户昵称已注册", CodeReferralCode: "邀请码无效", }
View Source
var MessagesJP = map[int]string{ CodeSuccess: "success", CodeFailed: "failed", CodeSystem: "system error", CodeInvalidToken: "token invalid", CodeNotFound: "not found", CodeParamInvalid: "parameter invalid", CodeParamRequired: "parameter require", CodeAuthBadSignature: "bad signature", CodeAuthInvalidUserOrPswd: "invalid user or password", CodeAuthPermissionDenied: "permission denied", CodeAuthNotFoundUser: "not found user", CodeIdentityNotFound: "not found identity", CodeRealNameVerifyRepeat: "realname verify repeat", CodeVerifyCode: "invalid verification code", CodeVerifyCodeRate: "verification code request too often", CodeIdentityRepeat: "identity registered", CodeNicknameRepeat: "nickname registered", CodeReferralCode: "invalid referral code", }
Functions ¶
func GetMessage ¶
func ToSystemError ¶
ToSystemError if not Error, to system error
Types ¶
Click to show internal directories.
Click to hide internal directories.