mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-06-25 11:50:23 +08:00
first name
This commit is contained in:
parent
f1502f02ca
commit
bede0f275f
@ -12,6 +12,7 @@ import (
|
||||
pbcrypto "github.com/openimsdk/protocol/crypto"
|
||||
"github.com/openimsdk/protocol/group"
|
||||
"github.com/openimsdk/protocol/msg"
|
||||
pbredpacket "github.com/openimsdk/protocol/redpacket"
|
||||
"github.com/openimsdk/protocol/relation"
|
||||
"github.com/openimsdk/protocol/rtc"
|
||||
"github.com/openimsdk/protocol/third"
|
||||
@ -117,6 +118,10 @@ func newGinRouter(ctx context.Context, client discovery.SvcDiscoveryRegistry, co
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
redpacketConn, err := client.GetConn(ctx, config.Share.RpcRegisterName.RedPacket)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
r := gin.New()
|
||||
if v, ok := binding.Validator.Engine().(*validator.Validate); ok {
|
||||
@ -243,9 +248,6 @@ func newGinRouter(ctx context.Context, client discovery.SvcDiscoveryRegistry, co
|
||||
groupRouterGroup.POST("/get_full_join_group_ids", g.GetFullJoinGroupIDs)
|
||||
groupRouterGroup.POST("/get_group_application_unhandled_count", g.GetGroupApplicationUnhandledCount)
|
||||
groupRouterGroup.POST("/get_common_groups_with_friend", g.GetCommonGroupsWithFriend)
|
||||
groupRouterGroup.POST("/pin_group_message", g.PinGroupMessage)
|
||||
groupRouterGroup.POST("/unpin_group_message", g.UnpinGroupMessage)
|
||||
groupRouterGroup.POST("/get_group_pinned_messages", g.GetGroupPinnedMessages)
|
||||
}
|
||||
// certificate
|
||||
{
|
||||
@ -366,6 +368,30 @@ func newGinRouter(ctx context.Context, client discovery.SvcDiscoveryRegistry, co
|
||||
cryptoGroup.POST("/integrity_report", cr.IntegrityReport)
|
||||
}
|
||||
|
||||
// RedPacket
|
||||
{
|
||||
rp := NewRedPacketApi(pbredpacket.NewRedPacketClient(redpacketConn))
|
||||
redpacketGroup := r.Group("/redpacket")
|
||||
redpacketGroup.POST("/create_order", rp.CreateOrder)
|
||||
redpacketGroup.POST("/created_callback", rp.CreatedCallback)
|
||||
redpacketGroup.POST("/detail", rp.GetDetail)
|
||||
redpacketGroup.POST("/issue_claim_sign", rp.IssueClaimSign)
|
||||
redpacketGroup.POST("/claim_result", rp.ClaimResult)
|
||||
redpacketGroup.POST("/request_refund", rp.RequestRefund)
|
||||
redpacketGroup.POST("/get_refund", rp.GetRefund)
|
||||
redpacketGroup.POST("/wallet_bind/challenge", rp.IssueWalletBindChallenge)
|
||||
redpacketGroup.POST("/wallet_bind/confirm", rp.ConfirmWalletBind)
|
||||
redpacketGroup.POST("/wallet_bind/detail", rp.GetWalletBinding)
|
||||
|
||||
adminGroup := redpacketGroup.Group("/admin")
|
||||
adminGroup.POST("/set_signer", rp.AdminSetSigner)
|
||||
adminGroup.POST("/set_token", rp.AdminSetToken)
|
||||
adminGroup.POST("/set_expiry", rp.AdminSetExpiry)
|
||||
adminGroup.POST("/set_allow_all_tokens", rp.AdminSetAllowAllTokens)
|
||||
adminGroup.POST("/set_native_token_enabled", rp.AdminSetNativeTokenEnabled)
|
||||
adminGroup.POST("/parse_tx_events", rp.AdminParseTxEvents)
|
||||
}
|
||||
|
||||
{
|
||||
statisticsGroup := r.Group("/statistics")
|
||||
statisticsGroup.POST("/user/register", u.UserRegisterCount)
|
||||
|
||||
@ -314,7 +314,11 @@ func (s *friendServer) GetFriendInfo(ctx context.Context, req *relation.GetFrien
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &relation.GetFriendInfoResp{FriendInfos: convert.FriendOnlyDB2PbOnly(friends)}, nil
|
||||
users, err := s.userClient.GetUsersInfoMap(ctx, req.FriendUserIDs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &relation.GetFriendInfoResp{FriendInfos: convert.FriendOnlyDB2PbOnly(friends, users)}, nil
|
||||
}
|
||||
|
||||
func (s *friendServer) GetDesignatedFriends(ctx context.Context, req *relation.GetDesignatedFriendsReq) (resp *relation.GetDesignatedFriendsResp, err error) {
|
||||
@ -693,7 +697,7 @@ func (s *friendServer) AddOnewayFriend(ctx context.Context, req *relation.ApplyT
|
||||
if in1 {
|
||||
return nil, servererrs.ErrRelationshipAlready.WrapMsg("already in friend list")
|
||||
}
|
||||
if err := s.db.BecomeOnewayFriend(ctx, req.FromUserID, req.ToUserID, becomeFriendByOneway, req.Remark); err != nil {
|
||||
if err := s.db.BecomeOnewayFriend(ctx, req.FromUserID, req.ToUserID, becomeFriendByOneway); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Notify only A (FromUserID) so incremental friend sync is triggered
|
||||
|
||||
@ -78,6 +78,8 @@ func FriendsDB2Pb(ctx context.Context, friendsDB []*model.Friend, getUsers func(
|
||||
friendPb.FriendUser.Nickname = users[friend.FriendUserID].Nickname
|
||||
friendPb.FriendUser.FaceURL = users[friend.FriendUserID].FaceURL
|
||||
friendPb.FriendUser.Ex = users[friend.FriendUserID].Ex
|
||||
friendPb.FriendUser.FirstName = users[friend.FriendUserID].FirstName
|
||||
friendPb.FriendUser.LastName = users[friend.FriendUserID].LastName
|
||||
friendPb.CreateTime = friend.CreateTime.Unix()
|
||||
friendPb.IsPinned = friend.IsPinned
|
||||
friendPb.IsMute = friend.IsMuted
|
||||
@ -88,9 +90,9 @@ func FriendsDB2Pb(ctx context.Context, friendsDB []*model.Friend, getUsers func(
|
||||
return friendsPb, nil
|
||||
}
|
||||
|
||||
func FriendOnlyDB2PbOnly(friendsDB []*model.Friend) []*relation.FriendInfoOnly {
|
||||
func FriendOnlyDB2PbOnly(friendsDB []*model.Friend, users map[string]*sdkws.UserInfo) []*relation.FriendInfoOnly {
|
||||
return datautil.Slice(friendsDB, func(f *model.Friend) *relation.FriendInfoOnly {
|
||||
return &relation.FriendInfoOnly{
|
||||
info := &relation.FriendInfoOnly{
|
||||
OwnerUserID: f.OwnerUserID,
|
||||
FriendUserID: f.FriendUserID,
|
||||
Remark: f.Remark,
|
||||
@ -103,6 +105,11 @@ func FriendOnlyDB2PbOnly(friendsDB []*model.Friend) []*relation.FriendInfoOnly {
|
||||
MuteDuration: f.MuteDuration,
|
||||
MuteEndTime: f.MuteEndTime,
|
||||
}
|
||||
if u, ok := users[f.FriendUserID]; ok {
|
||||
info.FirstName = u.FirstName
|
||||
info.LastName = u.LastName
|
||||
}
|
||||
return info
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user