test-errcode
wangchuxiao 2 years ago
parent 45ad252a44
commit e6b2a9f8f9

@ -85,7 +85,7 @@ func (c *conversationServer) BatchSetConversations(ctx context.Context, req *pbC
if err != nil {
return nil, err
}
c.conversationNotificationSender.ConversationChangeNotification(ctx, req.OwnerUserID)
_ = c.conversationNotificationSender.ConversationChangeNotification(ctx, req.OwnerUserID)
return &pbConversation.BatchSetConversationsResp{}, nil
}
@ -98,7 +98,7 @@ func (c *conversationServer) SetConversation(ctx context.Context, req *pbConvers
if err != nil {
return nil, err
}
c.conversationNotificationSender.ConversationChangeNotification(ctx, req.Conversation.OwnerUserID)
_ = c.conversationNotificationSender.ConversationChangeNotification(ctx, req.Conversation.OwnerUserID)
resp := &pbConversation.SetConversationResp{}
return resp, nil
}
@ -107,7 +107,7 @@ func (c *conversationServer) SetRecvMsgOpt(ctx context.Context, req *pbConversat
if err := c.conversationDatabase.SetUsersConversationFiledTx(ctx, []string{req.OwnerUserID}, &tableRelation.ConversationModel{OwnerUserID: req.OwnerUserID, ConversationID: req.ConversationID, RecvMsgOpt: req.RecvMsgOpt}, map[string]interface{}{"recv_msg_opt": req.RecvMsgOpt}); err != nil {
return nil, err
}
c.conversationNotificationSender.ConversationChangeNotification(ctx, req.OwnerUserID)
_ = c.conversationNotificationSender.ConversationChangeNotification(ctx, req.OwnerUserID)
return &pbConversation.SetRecvMsgOptResp{}, nil
}

@ -2,6 +2,7 @@ package msg
import (
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
@ -124,7 +125,7 @@ func (m *msgServer) GetMaxAndMinSeq(ctx context.Context, req *sdkws.GetMaxAndMin
if err := tokenverify.CheckAccessV3(ctx, req.UserID); err != nil {
return nil, err
}
resp := new(sdkws.GetMaxAndMinSeqResp)
m2 := make(map[string]*sdkws.MaxAndMinSeq)
maxSeq, err := m.MsgDatabase.GetUserMaxSeq(ctx, req.UserID)
if err != nil && errs.Unwrap(err) != redis.Nil {
@ -134,24 +135,25 @@ func (m *msgServer) GetMaxAndMinSeq(ctx context.Context, req *sdkws.GetMaxAndMin
if err != nil && errs.Unwrap(err) != redis.Nil {
return nil, err
}
resp := new(sdkws.GetMaxAndMinSeqResp)
resp.MaxSeq = maxSeq
resp.MinSeq = minSeq
if len(req.GroupIDs) > 0 {
for _, groupID := range req.GroupIDs {
maxSeq, err := m.MsgDatabase.GetGroupMaxSeq(ctx, groupID)
if err != nil && errs.Unwrap(err) != redis.Nil {
return nil, err
}
minSeq, err := m.MsgDatabase.GetGroupMinSeq(ctx, groupID)
if err != nil && errs.Unwrap(err) != redis.Nil {
return nil, err
}
m2[groupID] = &sdkws.MaxAndMinSeq{
MaxSeq: maxSeq,
MinSeq: minSeq,
}
for _, groupID := range req.GroupIDs {
maxSeq, err := m.MsgDatabase.GetGroupMaxSeq(ctx, groupID)
if err != nil && errs.Unwrap(err) != redis.Nil {
return nil, err
}
minSeq, err := m.MsgDatabase.GetGroupMinSeq(ctx, groupID)
if err != nil && errs.Unwrap(err) != redis.Nil {
return nil, err
}
m2[groupID] = &sdkws.MaxAndMinSeq{
MaxSeq: maxSeq,
MinSeq: minSeq,
}
}
resp.GroupMaxAndMinSeq = m2
return resp, nil
}

@ -137,7 +137,7 @@ func (m *MsgClient) PullMessageBySeqList(ctx context.Context, req *sdkws.PullMes
func (c *MsgClient) Notification(ctx context.Context, sendID, recvID string, contentType int32, m proto.Message, opts ...utils.OptionsOpt) error {
content, err := json.Marshal(m)
if err != nil {
log.ZError(ctx, "MsgClient Notification json.Marshal failed", err, "sendID", sendID, "recvID", recvID, "contentType", contentType, "sessionType", sessionType, "m", m)
log.ZError(ctx, "MsgClient Notification json.Marshal failed", err, "sendID", sendID, "recvID", recvID, "contentType", contentType, "msg", m)
return err
}
var req msg.SendMsgReq

Loading…
Cancel
Save