Merge branch 'tuoyun' of github.com:OpenIMSDK/Open-IM-Server into tuoyun

pull/137/head
wangchuxiao 3 years ago
commit caa915b31d

@ -45,7 +45,7 @@ func (mc *HistoryConsumerHandler) handleChatWs2Mongo(msg []byte, msgKey string)
isHistory := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsHistory) isHistory := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsHistory)
//Control whether to store history messages (mysql) //Control whether to store history messages (mysql)
isPersist := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsPersistent) isPersist := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsPersistent)
//isSenderSync := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsSenderSync) isSenderSync := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsSenderSync)
switch msgFromMQ.MsgData.SessionType { switch msgFromMQ.MsgData.SessionType {
case constant.SingleChatType: case constant.SingleChatType:
log.NewDebug(msgFromMQ.OperationID, "msg_transfer msg type = SingleChatType", isHistory, isPersist) log.NewDebug(msgFromMQ.OperationID, "msg_transfer msg type = SingleChatType", isHistory, isPersist)
@ -57,7 +57,10 @@ func (mc *HistoryConsumerHandler) handleChatWs2Mongo(msg []byte, msgKey string)
} }
log.NewDebug(msgFromMQ.OperationID, "sendMessageToPush cost time ", utils.GetCurrentTimestampByNano()-time) log.NewDebug(msgFromMQ.OperationID, "sendMessageToPush cost time ", utils.GetCurrentTimestampByNano()-time)
} }
go sendMessageToPush(&msgFromMQ, msgKey) if !isSenderSync && msgKey == msgFromMQ.MsgData.SendID {
} else {
go sendMessageToPush(&msgFromMQ, msgKey)
}
log.NewDebug(operationID, "saveUserChat cost time ", utils.GetCurrentTimestampByNano()-time) log.NewDebug(operationID, "saveUserChat cost time ", utils.GetCurrentTimestampByNano()-time)
case constant.GroupChatType: case constant.GroupChatType:
log.NewDebug(msgFromMQ.OperationID, "msg_transfer msg type = GroupChatType", isHistory, isPersist) log.NewDebug(msgFromMQ.OperationID, "msg_transfer msg type = GroupChatType", isHistory, isPersist)

@ -101,13 +101,15 @@ func (s *friendServer) AddFriend(ctx context.Context, req *pbFriend.AddFriendReq
} }
//Establish a latest relationship in the friend request table //Establish a latest relationship in the friend request table
friendRequest := db.FriendRequest{ReqMsg: req.ReqMsg, HandleResult: 0, CreateTime: time.Now()} friendRequest := db.FriendRequest{
HandleResult: 0, ReqMsg: req.ReqMsg, CreateTime: time.Now()}
utils.CopyStructFields(&friendRequest, req.CommID) utils.CopyStructFields(&friendRequest, req.CommID)
// {openIM001 openIM002 0 test add friend 0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC }] // {openIM001 openIM002 0 test add friend 0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC }]
log.NewDebug(req.CommID.OperationID, "UpdateFriendApplication args ", friendRequest) log.NewDebug(req.CommID.OperationID, "UpdateFriendApplication args ", friendRequest)
//err := imdb.InsertFriendApplication(&friendRequest) //err := imdb.InsertFriendApplication(&friendRequest)
err := imdb.InsertFriendApplication(&friendRequest, err := imdb.InsertFriendApplication(&friendRequest,
map[string]interface{}{"handle_result": 0, "req_msg": friendRequest.ReqMsg, "create_time": friendRequest.CreateTime}) map[string]interface{}{"handle_result": 0, "req_msg": friendRequest.ReqMsg, "create_time": friendRequest.CreateTime,
"handler_user_id": "", "handle_msg": "", "handle_time": utils.UnixSecondToTime(0), "ex": ""})
if err != nil { if err != nil {
log.NewError(req.CommID.OperationID, "UpdateFriendApplication failed ", err.Error(), friendRequest) log.NewError(req.CommID.OperationID, "UpdateFriendApplication failed ", err.Error(), friendRequest)
return &pbFriend.AddFriendResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil return &pbFriend.AddFriendResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil

Loading…
Cancel
Save