You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.5 KiB
Go

package errx
import (
"git.noahlan.cn/noahlan/ntool-biz/core/nstatus/code"
"git.noahlan.cn/noahlan/ntool-biz/core/nstatus/msg"
)
// Common
const (
WrongCode code.Code = iota + 1000 // 验证码错误
WrongCaptcha // 验证码错误
WrongPassword // 密码错误
UserNotFound // 用户不存在
NeedPhoneOrEmail // 请输入正确的手机号或邮箱
UnsupportedLoginType // 暂未支持此类型登录方式
)
// User register
const (
UsernameAlreadyExists code.Code = iota + 1100 // 用户名已注册
PasswordInvalidArgument // 密码格式错误
UserPhoneNumberAlreadyExists // 手机号码已被绑定
UserExists // 用户已存在
UserNicknameAlreadyExists // 用户昵称已存在
UserEmailAlreadyExists // 此邮箱已被注册
)
// User
const (
UpdateUserMetaErr code.Code = iota + 1200
)
// Role
const (
RoleCodeNotEmpty code.Code = iota + 1300
RoleCodeInUsed
)
// OAuthProvider
const (
OAuthProviderNameNotEmpty code.Code = iota + 1400
OAuthProviderNameInUsed
)
// UserSocial
const (
UserSocialUserIdNotEmpty code.Code = iota + 1500
)
// Dictionary
const (
DictionaryNameNotEmpty code.Code = iota + 1600
DictionaryNameInUsed
)
func init() {
// Common
msg.Add(WrongCode, "auth.wrongCode")
msg.Add(WrongCaptcha, "auth.wrongCaptcha")
msg.Add(WrongPassword, "auth.wrongPassword")
msg.Add(UserNotFound, "auth.userNotFound")
msg.Add(NeedPhoneOrEmail, "auth.needPhoneOrEmail")
msg.Add(UnsupportedLoginType, "auth.unsupportedLoginType")
// User Register
msg.Add(UsernameAlreadyExists, "register.user.usernameExists")
msg.Add(PasswordInvalidArgument, "register.user.passwordInvalid")
msg.Add(UserPhoneNumberAlreadyExists, "register.user.phoneNumberExists")
msg.Add(UserExists, "register.user.exists")
msg.Add(UserNicknameAlreadyExists, "register.user.nicknameExists")
msg.Add(UserEmailAlreadyExists, "register.user.emailExists")
// User
msg.Add(UpdateUserMetaErr, "user.updateMetaErr")
// Role
msg.Add(RoleCodeNotEmpty, "role.codeNotEmpty")
msg.Add(RoleCodeInUsed, "role.codeInUsed")
// OAuthProvider
msg.Add(OAuthProviderNameNotEmpty, "oauthProvider.nameNotEmpty")
msg.Add(OAuthProviderNameInUsed, "oauthProvider.nameInUsed")
// UserSocial
msg.Add(UserSocialUserIdNotEmpty, "userSocial.userIdNotEmpty")
}