@@ -1049,10 +1049,13 @@ func (c *Conversation) InsertSingleMessageToLocalStorage(callback open_im_sdk_ca
1049
1049
s := sdk_struct.MsgStruct {}
1050
1050
common .JsonUnmarshalAndArgsValidate (message , & s , callback , operationID )
1051
1051
if sendID != c .loginUserID {
1052
- friendInfo , _ := c .db .GetFriendInfoByFriendUserID (sendID )
1052
+ faceUrl , name , err := c .friend .GetUserNameAndFaceUrlByUid (& tmpCallback {}, sendID , operationID )
1053
+ if err != nil {
1054
+ log .Error (operationID , "getUserNameAndFaceUrlByUid err" , err .Error (), sendID )
1055
+ }
1053
1056
sourceID = sendID
1054
- s .SenderFaceURL = friendInfo . FaceURL
1055
- s .SenderNickname = friendInfo . Nickname
1057
+ s .SenderFaceURL = faceUrl
1058
+ s .SenderNickname = name
1056
1059
} else {
1057
1060
sourceID = recvID
1058
1061
}
@@ -1069,6 +1072,8 @@ func (c *Conversation) InsertSingleMessageToLocalStorage(callback open_im_sdk_ca
1069
1072
msgStructToLocalChatLog (& localMessage , & s )
1070
1073
conversation .LatestMsg = utils .StructToJsonString (s )
1071
1074
conversation .LatestMsgSendTime = s .SendTime
1075
+ conversation .FaceURL = s .SenderFaceURL
1076
+ conversation .ShowName = s .SenderNickname
1072
1077
_ = c .insertMessageToLocalStorage (callback , & localMessage , operationID )
1073
1078
callback .OnSuccess (utils .StructToJsonString (& s ))
1074
1079
_ = common .TriggerCmdUpdateConversation (common.UpdateConNode {ConID : conversation .ConversationID , Action : constant .AddConOrUpLatMsg , Args : conversation }, c .ch )
@@ -1086,9 +1091,12 @@ func (c *Conversation) InsertGroupMessageToLocalStorage(callback open_im_sdk_cal
1086
1091
s := sdk_struct.MsgStruct {}
1087
1092
common .JsonUnmarshalAndArgsValidate (message , & s , callback , operationID )
1088
1093
if sendID != c .loginUserID {
1089
- friendInfo , _ := c .db .GetFriendInfoByFriendUserID (sendID )
1090
- s .SenderFaceURL = friendInfo .FaceURL
1091
- s .SenderNickname = friendInfo .Nickname
1094
+ faceUrl , name , err := c .friend .GetUserNameAndFaceUrlByUid (& tmpCallback {}, sendID , operationID )
1095
+ if err != nil {
1096
+ log .Error (operationID , "getUserNameAndFaceUrlByUid err" , err .Error (), sendID )
1097
+ }
1098
+ s .SenderFaceURL = faceUrl
1099
+ s .SenderNickname = name
1092
1100
}
1093
1101
localMessage := db.LocalChatLog {}
1094
1102
s .SendID = sendID
@@ -1101,6 +1109,8 @@ func (c *Conversation) InsertGroupMessageToLocalStorage(callback open_im_sdk_cal
1101
1109
msgStructToLocalChatLog (& localMessage , & s )
1102
1110
conversation .LatestMsg = utils .StructToJsonString (s )
1103
1111
conversation .LatestMsgSendTime = s .SendTime
1112
+ conversation .FaceURL = s .SenderFaceURL
1113
+ conversation .ShowName = s .SenderNickname
1104
1114
_ = c .insertMessageToLocalStorage (callback , & localMessage , operationID )
1105
1115
callback .OnSuccess (utils .StructToJsonString (& s ))
1106
1116
_ = common .TriggerCmdUpdateConversation (common.UpdateConNode {ConID : conversation .ConversationID , Action : constant .AddConOrUpLatMsg , Args : conversation }, c .ch )
0 commit comments