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

# Conflicts:
#	internal/common/notification/conversation_notification.go
#	internal/common/notification/work_moments_notification.go
#	internal/rpc/conversation/conversaion.go
#	internal/rpc/group/callback.go
#	internal/rpc/group/group.go
#	internal/rpc/office/office.go
This commit is contained in:
skiffer-git
2023-02-10 21:05:49 +08:00
113 changed files with 1336 additions and 36247 deletions
+10 -10
View File
@@ -7,15 +7,15 @@ import (
commonDB "Open_IM/pkg/common/db"
"Open_IM/pkg/common/log"
open_im_sdk "Open_IM/pkg/proto/sdkws"
sdkws "Open_IM/pkg/proto/sdkws"
promePkg "Open_IM/pkg/common/prometheus"
)
func (rpc *rpcChat) GetMaxAndMinSeq(_ context.Context, in *open_im_sdk.GetMaxAndMinSeqReq) (*open_im_sdk.GetMaxAndMinSeqResp, error) {
func (rpc *rpcChat) GetMaxAndMinSeq(_ context.Context, in *sdkws.GetMaxAndMinSeqReq) (*sdkws.GetMaxAndMinSeqResp, error) {
log.NewInfo(in.OperationID, "rpc getMaxAndMinSeq is arriving", in.String())
resp := new(open_im_sdk.GetMaxAndMinSeqResp)
m := make(map[string]*open_im_sdk.MaxAndMinSeq)
resp := new(sdkws.GetMaxAndMinSeqResp)
m := make(map[string]*sdkws.MaxAndMinSeq)
var maxSeq, minSeq uint64
var err1, err2 error
maxSeq, err1 = commonDB.DB.GetUserMaxSeq(in.UserID)
@@ -35,7 +35,7 @@ func (rpc *rpcChat) GetMaxAndMinSeq(_ context.Context, in *open_im_sdk.GetMaxAnd
resp.MaxSeq = uint32(maxSeq)
resp.MinSeq = uint32(minSeq)
for _, groupID := range in.GroupIDList {
x := new(open_im_sdk.MaxAndMinSeq)
x := new(sdkws.MaxAndMinSeq)
maxSeq, _ := commonDB.DB.GetGroupMaxSeq(groupID)
minSeq, _ := commonDB.DB.GetGroupUserMinSeq(groupID, in.UserID)
x.MaxSeq = uint32(maxSeq)
@@ -46,10 +46,10 @@ func (rpc *rpcChat) GetMaxAndMinSeq(_ context.Context, in *open_im_sdk.GetMaxAnd
return resp, nil
}
func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *open_im_sdk.PullMessageBySeqListReq) (*open_im_sdk.PullMessageBySeqListResp, error) {
func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *sdkws.PullMessageBySeqListReq) (*sdkws.PullMessageBySeqListResp, error) {
log.NewInfo(in.OperationID, "rpc PullMessageBySeqList is arriving", in.String())
resp := new(open_im_sdk.PullMessageBySeqListResp)
m := make(map[string]*open_im_sdk.MsgDataList)
resp := new(sdkws.PullMessageBySeqListResp)
m := make(map[string]*sdkws.MsgDataList)
redisMsgList, failedSeqList, err := commonDB.DB.GetMessageListBySeq(in.UserID, in.SeqList, in.OperationID)
if err != nil {
if err != go_redis.Nil {
@@ -76,7 +76,7 @@ func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *open_im_sdk.Pull
}
for k, v := range in.GroupSeqList {
x := new(open_im_sdk.MsgDataList)
x := new(sdkws.MsgDataList)
redisMsgList, failedSeqList, err := commonDB.DB.GetMessageListBySeq(k, v.SeqList, in.OperationID)
if err != nil {
if err != go_redis.Nil {
@@ -108,7 +108,7 @@ func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *open_im_sdk.Pull
return resp, nil
}
type MsgFormats []*open_im_sdk.MsgData
type MsgFormats []*sdkws.MsgData
// Implement the sort.Interface interface to get the number of elements method
func (s MsgFormats) Len() int {
+1 -9
View File
@@ -750,7 +750,7 @@ func modifyMessageByUserMessageReceiveOptoptimization(userID, sourceID string, s
type NotificationMsg struct {
SendID string
RecvID string
Content []byte // open_im_sdk.TipsComm
Content []byte // sdkws.TipsComm
MsgFrom int32
ContentType int32
SessionType int32
@@ -975,14 +975,6 @@ func Notification(n *NotificationMsg) {
reliabilityLevel = config.Config.Notification.GroupMemberInfoSet.Conversation.ReliabilityLevel
unReadCount = config.Config.Notification.GroupMemberInfoSet.Conversation.UnreadCount
case constant.WorkMomentNotification:
pushSwitch = config.Config.Notification.WorkMomentsNotification.OfflinePush.PushSwitch
title = config.Config.Notification.WorkMomentsNotification.OfflinePush.Title
desc = config.Config.Notification.WorkMomentsNotification.OfflinePush.Desc
ex = config.Config.Notification.WorkMomentsNotification.OfflinePush.Ext
reliabilityLevel = config.Config.Notification.WorkMomentsNotification.Conversation.ReliabilityLevel
unReadCount = config.Config.Notification.WorkMomentsNotification.Conversation.UnreadCount
case constant.ConversationPrivateChatNotification:
pushSwitch = config.Config.Notification.ConversationSetPrivate.OfflinePush.PushSwitch
title = config.Config.Notification.ConversationSetPrivate.OfflinePush.Title
-52
View File
@@ -1,52 +0,0 @@
package msg
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
"Open_IM/pkg/common/log"
"Open_IM/pkg/getcdv3"
pbChat "Open_IM/pkg/proto/msg"
pbCommon "Open_IM/pkg/proto/sdkws"
"Open_IM/pkg/utils"
"context"
"strings"
)
func TagSendMessage(operationID string, user *im_mysql_model.User, recvID, content string, senderPlatformID int32) {
log.NewInfo(operationID, utils.GetSelfFuncName(), "args: ", user.UserID, recvID, content)
var req pbChat.SendMsgReq
var msgData pbCommon.MsgData
msgData.SendID = user.UserID
msgData.RecvID = recvID
msgData.ContentType = constant.Custom
msgData.SessionType = constant.SingleChatType
msgData.MsgFrom = constant.UserMsgType
msgData.Content = []byte(content)
msgData.SenderFaceURL = user.FaceURL
msgData.SenderNickname = user.Nickname
msgData.Options = map[string]bool{}
msgData.Options[constant.IsSenderConversationUpdate] = false
msgData.Options[constant.IsSenderNotificationPush] = false
msgData.CreateTime = utils.GetCurrentTimestampByMill()
msgData.ClientMsgID = utils.GetMsgID(user.UserID)
msgData.SenderPlatformID = senderPlatformID
req.MsgData = &msgData
req.OperationID = operationID
etcdConn := rpc.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, operationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil"
log.NewError(req.OperationID, errMsg)
return
}
client := pbChat.NewMsgClient(etcdConn)
respPb, err := client.SendMsg(context.Background(), &req)
if err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), "send msg failed", err.Error())
return
}
if respPb.ErrCode != 0 {
log.NewError(operationID, utils.GetSelfFuncName(), "send tag msg failed ", respPb)
}
}