Merge remote-tracking branch 'origin/v3dev' into v3dev

pull/476/head
withchao 1 year ago
commit 898adbb833

@ -53,6 +53,7 @@ type Client struct {
longConnServer LongConnServer
closed bool
closedErr error
token string
}
func newClient(ctx *UserConnContext, conn LongConn, isCompress bool) *Client {
@ -65,7 +66,7 @@ func newClient(ctx *UserConnContext, conn LongConn, isCompress bool) *Client {
ctx: ctx,
}
}
func (c *Client) ResetClient(ctx *UserConnContext, conn LongConn, isBackground, isCompress bool, longConnServer LongConnServer) {
func (c *Client) ResetClient(ctx *UserConnContext, conn LongConn, isBackground, isCompress bool, longConnServer LongConnServer, token string) {
c.w = new(sync.Mutex)
c.conn = conn
c.PlatformID = utils.StringToInt(ctx.GetPlatformID())
@ -77,6 +78,7 @@ func (c *Client) ResetClient(ctx *UserConnContext, conn LongConn, isBackground,
c.IsBackground = false
c.closed = false
c.closedErr = nil
c.token = token
}
func (c *Client) pongHandler(_ string) error {
c.conn.SetReadDeadline(pongWait)

@ -133,7 +133,7 @@ func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *pbMsg.SendMsgReq
}
if !isSend {
promePkg.Inc(promePkg.SingleChatMsgProcessFailedCounter)
return nil, errs.ErrUserNotRecvMsg
return nil, nil
} else {
if err = callbackBeforeSendSingleMsg(ctx, req); err != nil {
return nil, err

@ -2,6 +2,7 @@ package user
import (
"context"
"errors"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"strings"
"time"
@ -47,7 +48,7 @@ func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
}
users := make([]*tablerelation.UserModel, 0)
if len(config.Config.Manager.UserID) != len(config.Config.Manager.Nickname) {
return errs.ErrConfig.Wrap("len(config.Config.Manager.AppManagerUid) != len(config.Config.Manager.Nickname)")
return errors.New("len(config.Config.Manager.AppManagerUid) != len(config.Config.Manager.Nickname)")
}
for k, v := range config.Config.Manager.UserID {
users = append(users, &tablerelation.UserModel{UserID: v, Nickname: config.Config.Manager.Nickname[k]})

@ -26,7 +26,7 @@ const (
DatabaseError = 90002 //redis/mysql等db错误
NetworkError = 90004 //网络错误
DataError = 90007 //数据错误
ConfigError = 90009
CallbackError = 80000
//通用错误码
@ -38,51 +38,41 @@ const (
// 账号错误码
UserIDNotFoundError = 1101 //UserID不存在 或未注册
UserIDExisted = 1102 //UserID已存在
RegisteredAlreadyError = 1103 //用户已经注册过了
RegisteredAlreadyError = 1102 //用户已经注册过了
// 群组错误码
GroupIDNotFoundError = 1201 //GroupID不存在
GroupIDExisted = 1202 //GroupID已存在
OnlyOneOwnerError = 1203 //只能有一个群主
InGroupAlreadyError = 1204 //已在群组中
NotInGroupYetError = 1205 //不在群组中
DismissedAlreadyError = 1206 //群组已经解散
OwnerNotAllowedQuitError = 1207 //群主不能退群
GroupTypeNotSupport = 1208
GroupNoOwner = 1209
GroupRequestHandled = 1210
GroupIDNotFoundError = 1201 //GroupID不存在
GroupIDExisted = 1202 //GroupID已存在
NotInGroupYetError = 1203 //不在群组中
DismissedAlreadyError = 1204 //群组已经解散
GroupTypeNotSupport = 1205
GroupRequestHandled = 1206
// 关系链错误码
CanNotAddYourselfError = 1301 //不能添加自己为好友
BlockedByPeer = 1302 //被对方拉黑
NotPeersFriend = 1303 //不是对方的好友
RelationshipAlreadyError = 1304 //已经是好友关系(或者黑名单)
RelationshipAlreadyError = 1304 //已经是好友关系
// 消息错误码
MessageHasReadDisable = 1401
MutedInGroup = 1402 //群成员被禁言
MutedGroup = 1403 //群被禁言
UserNotRecvMsg = 1404 //用户设置了不接收消息
MsgAlreadyRevoke = 1405 //消息已撤回
MsgAlreadyRevoke = 1404 //消息已撤回
// token错误码
TokenExpiredError = 1501
TokenInvalidError = 1502
TokenMalformedError = 1503
TokenNotValidYetError = 1504
TokenUnknownError = 1505
TokenKickedError = 1506
TokenDifferentPlatformIDError = 1507
TokenDifferentUserIDError = 1508
TokenNotExistError = 1509
TokenExpiredError = 1501
TokenInvalidError = 1502
TokenMalformedError = 1503
TokenNotValidYetError = 1504
TokenUnknownError = 1505
TokenKickedError = 1506
TokenNotExistError = 1507
// 长连接网关错误码
ConnOverMaxNumLimit = 1601
ConnArgsErr = 1602
ConnUpdateErr = 1603
// S3错误码
FileUploadedCompleteError = 1701 // 文件已上传
FileUploadedExpiredError = 1702 // 上传过期
FileUploadedExpiredError = 1701 // 上传过期
)

@ -12,51 +12,39 @@ var (
ErrUserIDNotFound = NewCodeError(UserIDNotFoundError, "UserIDNotFoundError")
ErrGroupIDNotFound = NewCodeError(GroupIDNotFoundError, "GroupIDNotFoundError")
ErrGroupIDExisted = NewCodeError(GroupIDExisted, "GroupIDExisted")
ErrUserIDExisted = NewCodeError(UserIDExisted, "UserIDExisted")
ErrRecordNotFound = NewCodeError(RecordNotFoundError, "RecordNotFoundError")
ErrOnlyOneOwner = NewCodeError(OnlyOneOwnerError, "OnlyOneOwnerError")
ErrInGroupAlready = NewCodeError(InGroupAlreadyError, "InGroupAlreadyError")
ErrNotInGroupYet = NewCodeError(NotInGroupYetError, "NotInGroupYetError")
ErrDismissedAlready = NewCodeError(DismissedAlreadyError, "DismissedAlreadyError")
ErrOwnerNotAllowedQuit = NewCodeError(OwnerNotAllowedQuitError, "OwnerNotAllowedQuitError")
ErrRegisteredAlready = NewCodeError(RegisteredAlreadyError, "RegisteredAlreadyError")
ErrGroupTypeNotSupport = NewCodeError(GroupTypeNotSupport, "")
ErrGroupNoOwner = NewCodeError(GroupNoOwner, "ErrGroupNoOwner")
ErrData = NewCodeError(DataError, "DataError")
ErrTokenExpired = NewCodeError(TokenExpiredError, "TokenExpiredError")
ErrTokenInvalid = NewCodeError(TokenInvalidError, "TokenInvalidError") //
ErrTokenMalformed = NewCodeError(TokenMalformedError, "TokenMalformedError") //格式错误
ErrTokenNotValidYet = NewCodeError(TokenNotValidYetError, "TokenNotValidYetError") //还未生效
ErrTokenUnknown = NewCodeError(TokenUnknownError, "TokenUnknownError") //未知错误
ErrTokenKicked = NewCodeError(TokenKickedError, "TokenKickedError")
ErrTokenNotExist = NewCodeError(TokenNotExistError, "TokenNotExistError") //在redis中不存在
ErrTokenDifferentPlatformID = NewCodeError(TokenDifferentPlatformIDError, "TokenDifferentPlatformIDError")
ErrTokenDifferentUserID = NewCodeError(TokenDifferentUserIDError, "TokenDifferentUserIDError")
ErrDuplicateKey = NewCodeError(DuplicateKeyError, "DuplicateKeyError")
ErrGroupRequestHandled = NewCodeError(GroupRequestHandled, "GroupRequestHandled")
ErrData = NewCodeError(DataError, "DataError")
ErrTokenExpired = NewCodeError(TokenExpiredError, "TokenExpiredError")
ErrTokenInvalid = NewCodeError(TokenInvalidError, "TokenInvalidError") //
ErrTokenMalformed = NewCodeError(TokenMalformedError, "TokenMalformedError") //格式错误
ErrTokenNotValidYet = NewCodeError(TokenNotValidYetError, "TokenNotValidYetError") //还未生效
ErrTokenUnknown = NewCodeError(TokenUnknownError, "TokenUnknownError") //未知错误
ErrTokenKicked = NewCodeError(TokenKickedError, "TokenKickedError")
ErrTokenNotExist = NewCodeError(TokenNotExistError, "TokenNotExistError") //在redis中不存在
ErrDuplicateKey = NewCodeError(DuplicateKeyError, "DuplicateKeyError")
ErrMessageHasReadDisable = NewCodeError(MessageHasReadDisable, "MessageHasReadDisable")
ErrRelationshipAlready = NewCodeError(RelationshipAlreadyError, "RelationshipAlreadyError")
ErrCanNotAddYourself = NewCodeError(CanNotAddYourselfError, "CanNotAddYourselfError")
ErrBlockedByPeer = NewCodeError(BlockedByPeer, "BlockedByPeer")
ErrNotPeersFriend = NewCodeError(NotPeersFriend, "NotPeersFriend")
ErrRelationshipAlready = NewCodeError(RelationshipAlreadyError, "RelationshipAlreadyError")
ErrMutedInGroup = NewCodeError(MutedInGroup, "MutedInGroup")
ErrMutedGroup = NewCodeError(MutedGroup, "MutedGroup")
ErrUserNotRecvMsg = NewCodeError(UserNotRecvMsg, "UserNotRecvMsg")
ErrMsgAlreadyRevoke = NewCodeError(MsgAlreadyRevoke, "MsgAlreadyRevoke")
ErrConnOverMaxNumLimit = NewCodeError(ConnOverMaxNumLimit, "ConnOverMaxNumLimit")
ErrConnArgsErr = NewCodeError(ConnArgsErr, "args err, need token, sendID, platformID")
ErrConnUpdateErr = NewCodeError(ConnArgsErr, "upgrade http conn err")
ErrConfig = NewCodeError(ConfigError, "ConfigError")
ErrConnArgsErr = NewCodeError(ConnArgsErr, "args err, need token, sendID, platformID")
ErrFileUploadedComplete = NewCodeError(FileUploadedCompleteError, "FileUploadedComplete")
ErrFileUploadedExpired = NewCodeError(FileUploadedExpiredError, "FileUploadedExpiredError")
ErrGroupRequestHandled = NewCodeError(GroupRequestHandled, "GroupRequestHandled")
ErrFileUploadedExpired = NewCodeError(FileUploadedExpiredError, "FileUploadedExpiredError")
)

Loading…
Cancel
Save