diff --git a/internal/rpc/friend/firend.go b/internal/rpc/friend/firend.go index 37abff801..b4660bd49 100644 --- a/internal/rpc/friend/firend.go +++ b/internal/rpc/friend/firend.go @@ -408,9 +408,9 @@ func (s *friendServer) GetFriendList(ctx context.Context, req *pbFriend.GetFrien } var userInfoList []*sdkws.FriendInfo for _, friendUser := range friends { - log.NewDebug(req.CommID.OperationID, "friends : ", friendUser) var friendUserInfo sdkws.FriendInfo - utils.CopyStructFields(&friendUserInfo, &friendUser) + cp.FriendDBCopyOpenIM(&friendUserInfo, &friendUser) + log.NewDebug(req.CommID.OperationID, "friends : ", friendUser, "openim friends: ", friendUserInfo) userInfoList = append(userInfoList, &friendUserInfo) } log.NewInfo(req.CommID.OperationID, "rpc GetFriendList ok", pbFriend.GetFriendListResp{FriendInfoList: userInfoList}) diff --git a/pkg/common/utils/utils.go b/pkg/common/utils/utils.go index ca67f33e2..61dc47be0 100644 --- a/pkg/common/utils/utils.go +++ b/pkg/common/utils/utils.go @@ -14,12 +14,12 @@ func OperationIDGenerator() string { return strconv.FormatInt(time.Now().UnixNano()+int64(rand.Uint32()), 10) } -func FriendOpenIMCopyDB(dst *imdb.Friend, src open_im_sdk.FriendInfo) { +func FriendOpenIMCopyDB(dst *imdb.Friend, src *open_im_sdk.FriendInfo) { utils.CopyStructFields(dst, src) dst.FriendUserID = src.FriendUser.UserID } -func FriendDBCopyOpenIM(dst *open_im_sdk.FriendInfo, src imdb.Friend) { +func FriendDBCopyOpenIM(dst *open_im_sdk.FriendInfo, src *imdb.Friend) { utils.CopyStructFields(dst, src) user, _ := imdb.GetUserByUserID(src.FriendUserID) if user != nil { @@ -30,21 +30,21 @@ func FriendDBCopyOpenIM(dst *open_im_sdk.FriendInfo, src imdb.Friend) { } // -func FriendRequestOpenIMCopyDB(dst *imdb.FriendRequest, src open_im_sdk.FriendRequest) { +func FriendRequestOpenIMCopyDB(dst *imdb.FriendRequest, src *open_im_sdk.FriendRequest) { utils.CopyStructFields(dst, src) } -func FriendRequestDBCopyOpenIM(dst *open_im_sdk.FriendRequest, src imdb.FriendRequest) { +func FriendRequestDBCopyOpenIM(dst *open_im_sdk.FriendRequest, src *imdb.FriendRequest) { utils.CopyStructFields(dst, src) dst.CreateTime = src.CreateTime.Unix() dst.HandleTime = src.HandleTime.Unix() } -func GroupOpenIMCopyDB(dst *imdb.Group, src open_im_sdk.GroupInfo) { +func GroupOpenIMCopyDB(dst *imdb.Group, src *open_im_sdk.GroupInfo) { utils.CopyStructFields(dst, src) } -func GroupDBCopyOpenIM(dst *open_im_sdk.GroupInfo, src imdb.Group) { +func GroupDBCopyOpenIM(dst *open_im_sdk.GroupInfo, src *imdb.Group) { utils.CopyStructFields(dst, src) user, _ := imdb.GetGroupOwnerInfoByGroupID(src.GroupID) if user != nil { @@ -54,11 +54,11 @@ func GroupDBCopyOpenIM(dst *open_im_sdk.GroupInfo, src imdb.Group) { dst.CreateTime = src.CreateTime.Unix() } -func GroupMemberOpenIMCopyDB(dst *imdb.GroupMember, src open_im_sdk.GroupMemberFullInfo) { +func GroupMemberOpenIMCopyDB(dst *imdb.GroupMember, src *open_im_sdk.GroupMemberFullInfo) { utils.CopyStructFields(dst, src) } -func GroupMemberDBCopyOpenIM(dst *open_im_sdk.GroupMemberFullInfo, src imdb.GroupMember) { +func GroupMemberDBCopyOpenIM(dst *open_im_sdk.GroupMemberFullInfo, src *imdb.GroupMember) { utils.CopyStructFields(dst, src) if token_verify.IsMangerUserID(src.UserID) { u, _ := imdb.GetUserByUserID(src.UserID) @@ -70,31 +70,31 @@ func GroupMemberDBCopyOpenIM(dst *open_im_sdk.GroupMemberFullInfo, src imdb.Grou dst.JoinTime = src.JoinTime.Unix() } -func GroupRequestOpenIMCopyDB(dst *imdb.GroupRequest, src open_im_sdk.GroupRequest) { +func GroupRequestOpenIMCopyDB(dst *imdb.GroupRequest, src *open_im_sdk.GroupRequest) { utils.CopyStructFields(dst, src) } -func GroupRequestDBCopyOpenIM(dst *open_im_sdk.GroupRequest, src imdb.GroupRequest) { +func GroupRequestDBCopyOpenIM(dst *open_im_sdk.GroupRequest, src *imdb.GroupRequest) { utils.CopyStructFields(dst, src) dst.ReqTime = src.ReqTime.Unix() dst.HandleTime = src.HandledTime.Unix() } -func UserOpenIMCopyDB(dst *imdb.User, src open_im_sdk.UserInfo) { +func UserOpenIMCopyDB(dst *imdb.User, src *open_im_sdk.UserInfo) { utils.CopyStructFields(dst, src) } -func UserDBCopyOpenIM(dst *open_im_sdk.UserInfo, src imdb.User) { +func UserDBCopyOpenIM(dst *open_im_sdk.UserInfo, src *imdb.User) { utils.CopyStructFields(dst, src) dst.CreateTime = src.CreateTime.Unix() } -func BlackOpenIMCopyDB(dst *imdb.Black, src open_im_sdk.BlackInfo) { +func BlackOpenIMCopyDB(dst *imdb.Black, src *open_im_sdk.BlackInfo) { utils.CopyStructFields(dst, src) dst.BlockUserID = src.BlackUserInfo.UserID } -func BlackDBCopyOpenIM(dst *open_im_sdk.BlackInfo, src imdb.Black) { +func BlackDBCopyOpenIM(dst *open_im_sdk.BlackInfo, src *imdb.Black) { utils.CopyStructFields(dst, src) dst.CreateTime = src.CreateTime.Unix() user, _ := imdb.GetUserByUserID(src.BlockUserID)