同步历史版本代码

This commit is contained in:
2026-03-03 09:32:22 -08:00
parent 7d46b31866
commit 4d8516b2e1
140 changed files with 8399 additions and 489 deletions
+19 -13
View File
@@ -18,17 +18,22 @@ const (
// User error
const (
UserExist uint32 = 20001
UserNotExist uint32 = 20002
UserPasswordError uint32 = 20003
UserDisabled uint32 = 20004
InsufficientBalance uint32 = 20005
StopRegister uint32 = 20006
TelegramNotBound uint32 = 20007
UserNotBindOauth uint32 = 20008
InviteCodeError uint32 = 20009
UserCommissionNotEnough uint32 = 20010
RegisterIPLimit uint32 = 20011
UserExist uint32 = 20001
UserNotExist uint32 = 20002
UserPasswordError uint32 = 20003
UserDisabled uint32 = 20004
InsufficientBalance uint32 = 20005
StopRegister uint32 = 20006
TelegramNotBound uint32 = 20007
UserNotBindOauth uint32 = 20008
InviteCodeError uint32 = 20009
UserCommissionNotEnough uint32 = 20010
RegisterIPLimit uint32 = 20011
EmailBindError uint32 = 20012
UserBindInviteCodeExist uint32 = 20013
FamilyMemberLimitExceeded uint32 = 20014
FamilyAlreadyBound uint32 = 20015
FamilyCrossBindForbidden uint32 = 20016
)
// Node error
@@ -115,8 +120,9 @@ const (
TelephoneError uint32 = 90014
)
const (
DeviceNotExist uint32 = 90017
UseridNotMatch uint32 = 90018
DeviceNotExist uint32 = 90017
UseridNotMatch uint32 = 90018
DeviceBindLimitExceeded uint32 = 90019
)
const (
+15 -10
View File
@@ -24,16 +24,21 @@ func init() {
DatabaseDeletedError: "Database deleted error",
// User error
UserExist: "User already exists",
UserNotExist: "User does not exist",
UserPasswordError: "User password error",
UserDisabled: "User disabled",
InsufficientBalance: "Insufficient balance",
StopRegister: "Stop register",
TelegramNotBound: "Telegram not bound ",
UserNotBindOauth: "User not bind oauth method",
InviteCodeError: "Invite code error",
RegisterIPLimit: "Too many registrations",
UserExist: "User already exists",
UserNotExist: "User does not exist",
UserPasswordError: "User password error",
UserDisabled: "User disabled",
InsufficientBalance: "Insufficient balance",
StopRegister: "Stop register",
TelegramNotBound: "Telegram not bound ",
UserNotBindOauth: "User not bind oauth method",
InviteCodeError: "Invite code error",
RegisterIPLimit: "Too many registrations",
EmailBindError: "Email already bound",
UserBindInviteCodeExist: "Invite code already bound",
FamilyMemberLimitExceeded: "Family member limit exceeded",
FamilyAlreadyBound: "Family already bound",
FamilyCrossBindForbidden: "Cross-family binding is forbidden",
// Node error
NodeExist: "Node already exists",
+19
View File
@@ -0,0 +1,19 @@
package xerr
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestFamilyErrorCodeMessages(t *testing.T) {
require.Equal(t, "Family member limit exceeded", MapErrMsg(FamilyMemberLimitExceeded))
require.Equal(t, "Family already bound", MapErrMsg(FamilyAlreadyBound))
require.Equal(t, "Cross-family binding is forbidden", MapErrMsg(FamilyCrossBindForbidden))
}
func TestFamilyErrorCodeIsRegistered(t *testing.T) {
require.True(t, IsCodeErr(FamilyMemberLimitExceeded))
require.True(t, IsCodeErr(FamilyAlreadyBound))
require.True(t, IsCodeErr(FamilyCrossBindForbidden))
}