|
|
@ -88,12 +88,11 @@ func syncPeerUserConversation(conversation *pbUser.Conversation, operationID str
|
|
|
|
AttachedInfo: "",
|
|
|
|
AttachedInfo: "",
|
|
|
|
Ex: "",
|
|
|
|
Ex: "",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
err := imdb.CreateConversationIfNotExist(peerUserConversation)
|
|
|
|
err := imdb.PeerUserSetConversation(peerUserConversation)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
log.NewError(operationID, utils.GetSelfFuncName(), "SetConversation error", err.Error())
|
|
|
|
log.NewError(operationID, utils.GetSelfFuncName(), "SetConversation error", err.Error())
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
chat.SetConversationNotification(operationID, conversation.UserID)
|
|
|
|
chat.SetConversationNotification(operationID, conversation.UserID)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
@ -140,9 +139,9 @@ func (s *userServer) BatchSetConversations(ctx context.Context, req *pbUser.Batc
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
resp.Success = append(resp.Success, v.ConversationID)
|
|
|
|
resp.Success = append(resp.Success, v.ConversationID)
|
|
|
|
//if err := syncPeerUserConversation(v, req.OperationID); err != nil {
|
|
|
|
if err := syncPeerUserConversation(v, req.OperationID); err != nil {
|
|
|
|
// log.NewError(req.OperationID, utils.GetSelfFuncName(), "syncPeerUserConversation", err.Error())
|
|
|
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "syncPeerUserConversation", err.Error())
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
chat.SetConversationNotification(req.OperationID, req.OwnerUserID)
|
|
|
|
chat.SetConversationNotification(req.OperationID, req.OwnerUserID)
|
|
|
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return", resp.String())
|
|
|
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return", resp.String())
|
|
|
@ -219,10 +218,12 @@ func (s *userServer) SetConversation(ctx context.Context, req *pbUser.SetConvers
|
|
|
|
resp.CommonResp = &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
|
|
|
|
resp.CommonResp = &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
|
|
|
|
return resp, nil
|
|
|
|
return resp, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// sync peer user conversation if conversation is singleChatType
|
|
|
|
//sync peer user conversation if conversation is singleChatType
|
|
|
|
//if err := syncPeerUserConversation(req.Conversation, req.OperationID); err != nil {
|
|
|
|
if err := syncPeerUserConversation(req.Conversation, req.OperationID); err != nil {
|
|
|
|
// log.NewError(req.OperationID, utils.GetSelfFuncName(), "syncPeerUserConversation", err.Error())
|
|
|
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "syncPeerUserConversation", err.Error())
|
|
|
|
//}
|
|
|
|
resp.CommonResp = &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
|
|
|
|
|
|
|
|
return resp, nil
|
|
|
|
|
|
|
|
}
|
|
|
|
chat.SetConversationNotification(req.OperationID, req.Conversation.OwnerUserID)
|
|
|
|
chat.SetConversationNotification(req.OperationID, req.Conversation.OwnerUserID)
|
|
|
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return", resp.String())
|
|
|
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return", resp.String())
|
|
|
|
resp.CommonResp = &pbUser.CommonResp{}
|
|
|
|
resp.CommonResp = &pbUser.CommonResp{}
|
|
|
@ -241,6 +242,17 @@ func (s *userServer) SetRecvMsgOpt(ctx context.Context, req *pbUser.SetRecvMsgOp
|
|
|
|
resp.CommonResp = &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
|
|
|
|
resp.CommonResp = &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
|
|
|
|
return resp, nil
|
|
|
|
return resp, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stringList := strings.Split(req.ConversationID, "_")
|
|
|
|
|
|
|
|
if len(stringList) > 1 {
|
|
|
|
|
|
|
|
switch stringList[0] {
|
|
|
|
|
|
|
|
case "single_":
|
|
|
|
|
|
|
|
conversation.UserID = stringList[1]
|
|
|
|
|
|
|
|
conversation.ConversationType = constant.SingleChatType
|
|
|
|
|
|
|
|
case "group":
|
|
|
|
|
|
|
|
conversation.GroupID = stringList[1]
|
|
|
|
|
|
|
|
conversation.ConversationType = constant.GroupChatType
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
err := imdb.SetRecvMsgOpt(conversation)
|
|
|
|
err := imdb.SetRecvMsgOpt(conversation)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetConversation error", err.Error())
|
|
|
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetConversation error", err.Error())
|
|
|
|