|
|
@ -40,18 +40,28 @@ func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *open_im_sdk.Pull
|
|
|
|
log.NewInfo(in.OperationID, "rpc PullMessageBySeqList is arriving", in.String())
|
|
|
|
log.NewInfo(in.OperationID, "rpc PullMessageBySeqList is arriving", in.String())
|
|
|
|
resp := new(open_im_sdk.PullMessageBySeqListResp)
|
|
|
|
resp := new(open_im_sdk.PullMessageBySeqListResp)
|
|
|
|
//msgList, err := commonDB.DB.GetMsgBySeqList(in.UserID, in.SeqList, in.OperationID)
|
|
|
|
//msgList, err := commonDB.DB.GetMsgBySeqList(in.UserID, in.SeqList, in.OperationID)
|
|
|
|
msgList, err := commonDB.DB.GetMsgBySeqListMongo2(in.UserID, in.SeqList, in.OperationID)
|
|
|
|
redisMsgList, failedSeqList, err := commonDB.DB.GetMessageListBySeq(in.UserID, in.SeqList, in.OperationID)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
log.Error(in.OperationID, "PullMessageBySeqList data error", in.String(), err.Error())
|
|
|
|
if err != redis.ErrNil {
|
|
|
|
resp.ErrCode = 201
|
|
|
|
log.Error(in.OperationID, "get message from redis exception", err.Error(), failedSeqList)
|
|
|
|
resp.ErrMsg = err.Error()
|
|
|
|
} else {
|
|
|
|
return resp, nil
|
|
|
|
log.Debug(in.OperationID, "get message from redis is nil", failedSeqList)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
msgList, err1 := commonDB.DB.GetMsgBySeqListMongo2(in.UserID, failedSeqList, in.OperationID)
|
|
|
|
|
|
|
|
if err1 != nil {
|
|
|
|
|
|
|
|
log.Error(in.OperationID, "PullMessageBySeqList data error", in.String(), err.Error())
|
|
|
|
|
|
|
|
resp.ErrCode = 201
|
|
|
|
|
|
|
|
resp.ErrMsg = err.Error()
|
|
|
|
|
|
|
|
return resp, nil
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
redisMsgList = append(redisMsgList, msgList...)
|
|
|
|
|
|
|
|
resp.List = redisMsgList
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
resp.List = redisMsgList
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//respSingleMsgFormat = singleMsgHandleByUser(SingleMsgFormat, in.UserID)
|
|
|
|
//respSingleMsgFormat = singleMsgHandleByUser(SingleMsgFormat, in.UserID)
|
|
|
|
//respGroupMsgFormat = groupMsgHandleByUser(GroupMsgFormat)
|
|
|
|
//respGroupMsgFormat = groupMsgHandleByUser(GroupMsgFormat)
|
|
|
|
resp.ErrCode = 0
|
|
|
|
|
|
|
|
resp.ErrMsg = ""
|
|
|
|
|
|
|
|
resp.List = msgList
|
|
|
|
|
|
|
|
return resp, nil
|
|
|
|
return resp, nil
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|