code

package
v0.0.0-...-b08fcc5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Success            = 0
	BadRequest         = 9000
	VerificationFailed = 9001
	InternalServer     = 9002
	InvalidParam       = 9003

	NotLogin               = 9100
	NoPhoneBound           = 9101
	NoPermission           = 9102
	ActionFailed           = 9103
	AccountCountryNotFound = 9104
	AccountBanned          = 9105
	AliPayRequestErr       = 9109

	UnKnown = 100000
)

Variables

View Source
var (
	AccountNotFound           = Def(DBError, 1201, "账号不存在")
	AccountExists             = Def(LogicError, 1202, "相关账号已存在")
	AccountBoundMobile        = Def(LogicError, 1204, "账号已经绑定手机号")
	MobileExists              = Def(LogicError, 1205, "手机号已被使用")
	RepetitionNicknameErr     = Def(LogicError, 1206, "昵称已被使用")
	AccountOrPasswordError    = Def(LogicError, 1207, "账号或密码错误")
	AccountBoundMail          = Def(LogicError, 1208, "账号已经绑定邮箱")
	MailExists                = Def(LogicError, 1209, "手机号已被使用")
	NoneUpdateNicknameNum     = Def(LogicError, 1210, "没有修改昵称次数")
	NicknameFitError          = Def(LogicError, 1211, "与原昵称一致")
	RedisFailed               = Def(DBError, 1003, "缓存操作失败")
	DBFailed                  = Def(DBError, 1004, "数据库操作失败")
	MobileError               = Def(LogicError, 1000, "手机号码格式错误")
	RepeatError               = Def(LogicError, 1001, "请勿重复发送")
	VCodeError                = Def(LogicError, 1002, "验证码错误")
	VCodePastError            = Def(LogicError, 1003, "请重新获取验证码")
	RegionCodeError           = Def(LogicError, 1004, "国家码格式错误")
	VCodeSendError            = Def(LogicError, 1005, "验证码发送失败")
	PasswordError             = Def(LogicError, 1006, "登录密码不正确")
	PasswordLengthError       = Def(LogicError, 1007, "密码长度错误")
	PasswordLowercaseError    = Def(LogicError, 1008, "密码必须包含小写字母")
	PasswordUppercaseError    = Def(LogicError, 1009, "密码必须包含大写字母")
	PasswordNumberError       = Def(LogicError, 1010, "密码必须包含数字")
	PasswordSpecialError      = Def(LogicError, 1011, "密码必须包含特殊字符")
	PasswordNullError         = Def(LogicError, 1012, "未设置密码")
	UserMobileExistError      = Def(LogicError, 1013, "该手机已绑定过,请输入其它手机号")
	PasswordFormatError       = Def(LogicError, 1014, "密码长度在6位及以上,包含数字、小写字母、大写字母、特殊字符两种或以上")
	IdentityVerifyRepeatError = Def(LogicError, 1015, "已实名认证,请勿重复认证")
	IdCardNoFormatError       = Def(LogicError, 1016, "请输入正确的身份证号")
	NicknameFormatError       = Def(LogicError, 1017, "昵称不能包含特殊字符,或小于4位或大于16位字符")
	NicknameRepeatError       = Def(LogicError, 1018, "昵称已存在,请修改重试")
	VCodeLoseError            = Def(LogicError, 1019, "验证码失效")
	ImgUploadError            = Def(LogicError, 1020, "图片上传失败,请重新上传")
	UserBanError              = Def(LogicError, 1021, "账户已被封禁")
	NoActivationError         = Def(LogicError, 1022, "账户未激活")
	AccountWriteOffError      = Def(LogicError, 1023, "账户已注销")
	AccountNoWriteOffError    = Def(LogicError, 1024, "账户未注销")

	ThirdBindError      = Def(LogicError, 1100, "绑定失败")
	GeneratePubKeyError = Def(LogicError, 1101, "构造苹果验证公钥失败")
	AppleJwtError       = Def(LogicError, 1102, "苹果验证token无效")
	AppleJwtVerifyError = Def(LogicError, 1103, "苹果验证token错误")
	InvalidCodeError    = Def(LogicError, 1104, "code 无效")
	CodeBeenUsedError   = Def(LogicError, 1105, "code 已使用")

	UserInfoAddError      = Def(DBError, 1151, "保存用户授权信息失败")
	UserInfoQueryError    = Def(DBError, 1152, "查询用户授权信息失败")
	UserInfoNotFoundError = Def(LogicError, 1153, "用户授权信息不存在")
	ThirdPartApiError     = Def(LogicError, 1154, "调用第三方接口错误")

	DeviceMarshalError   = Def(LogicError, 1141, "设备信息序列化异常")
	DeviceUnmarshalError = Def(LogicError, 1142, "设备信息反序列化异常")
	TokenMarshalError    = Def(LogicError, 1143, "token信息序列化异常")
	TokenUnmarshalError  = Def(LogicError, 1144, "token信息反序列化异常")
	TokenDfError         = Def(LogicError, 1145, "设备指纹错误")

	GetHashDataError = Def(DBError, 1131, "查询hash失败")
	SetHashDataError = Def(DBError, 1132, "保存hash失败")
	DelHashDataError = Def(DBError, 1133, "删除hash失败")

	TokenNotExist = Def(LogicError, 1111, "token不存在")
	ParamsError   = Def(LogicError, 1301, "参数错误")

	CheckTTLError       = Def(DBError, 1110, "查询有效时间失败")
	CheckExpireError    = Def(DBError, 1119, "查询失效时间失败")
	CheckDataExistError = Def(DBError, 1112, "查询exist失败")

	WithdrawError            = Def(LogicError, 1025, "账户状态不允许提现")
	CodeTplParseError        = Def(LogicError, 1026, "tpc parse error")
	UserNotExistError        = Def(LogicError, 1027, "账号不存在")
	UserModelNotFoundError   = Def(LogicError, 1200, "你还没捏脸噢")
	UserNotCertificatedError = Def(LogicError, 1201, "你还没实名认证噢")

	ServiceError          = Def(LogicError, 2001, "服务异常")
	ResoureceError        = Def(LogicError, 2000, "资源链接失败")
	DataError             = Def(LogicError, 3000, "数据异常")
	DelError              = Def(LogicError, 3001, "删除失败")
	AddError              = Def(LogicError, 3002, "添加失败")
	UseError              = Def(LogicError, 3100, "操作失败")
	RelationEmpty         = Def(LogicError, 3101, "关系不存在")
	RelationAddError      = Def(LogicError, 3102, "已添加 无需重复操作")
	RelationaDelError     = Def(LogicError, 3103, "已取关 无需重复操作")
	RelationBlockHasError = Def(LogicError, 3104, "不可关注对方")

	UserInviteCountryErr = Def(LogicError, 4000, "用户邀请失败,国家不一致")
	UserInviteFignerErr  = Def(LogicError, 4001, "用户邀请失败,指纹一致")
	UserAvatarError      = Def(LogicError, 4002, "头像内容不合法")
	UserAvatarSizeError  = Def(LogicError, 4003, "头像大小不合法")

	ActivityParamExsit = Def(LogicError, 5001, "活动已存在")

	ThirdGameTransferAmountNotEmpty   = Def(LogicError, 6001, "划转金额不能为0")
	ThirdGameTransferAmountOverrun    = Def(LogicError, 6002, "划转⾦额最大为2000万金币")
	ThirdGameWithdrawalAmountNotEmpty = Def(LogicError, 6003, "提现金额不能为0")
	ThirdGameWithdrawalAmountOverrun  = Def(LogicError, 6004, "提现⾦额最大为2000万金币")
	ThirdGameAclFailed                = Def(LogicError, 6010, "操作失败,请联系客服。")
)
View Source
var (
	ErrorBadRequest         = new499Response(BadRequest, "请求发生错误")
	ErrorVerificationFailed = new499Response(VerificationFailed, "校验失败")
	ErrorInternalServer     = new500Response(InternalServer, "服务器内部错误")
	ErrorInvalidParam       = new499Response(InvalidParam, "请求参数不合法")
	ErrorNotLogin           = new499Response(NotLogin, "用户未登录")
	ErrorNoPhoneBound       = new499Response(NoPhoneBound, "用户未绑定手机号")
	ErrorNoPermission       = new499Response(NoPermission, "无权限操作")
	ErrorActionFailed       = new499Response(ActionFailed, "操作失败")
	ErrorBannedFailed       = new499Response(AccountBanned, "Account blocked")
	ErrorCountryNotFound    = new499Response(AccountCountryNotFound, "当前国家未知")
)
View Source
var (
	ErrorMessages = make(map[int32]string)
	ID            int32
	Name          string
)

Functions

func Def

func Def(t ErrorType, code int32, message string) error

func Init

func Init(id int32, name string) error

Types

type ErrorType

type ErrorType int32
var (
	LogicError     ErrorType = 1 // 代码逻辑错误
	DBError        ErrorType = 2 // 数据库错误,mysql/redis
	ThirdPartError ErrorType = 3 // 调用第三方服务出错
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL