From 8beb5c2e7bbb527c223b7ecbeb08326d0ae1bdab Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Tue, 6 Jun 2023 20:41:07 +0800 Subject: [PATCH 1/3] GroupApplicationResponse --- internal/rpc/group/group.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 84c13e88f..adcb236cc 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -764,6 +764,7 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup if !inGroup { groupMember := &relationTb.GroupMemberModel{} groupMember.GroupID = group.GroupID + groupMember.UserID = req.FromUserID groupMember.RoleLevel = constant.GroupOrdinaryUsers groupMember.OperatorUserID = mcontext.GetOpUserID(ctx) groupMember.JoinSource = groupRequest.JoinSource From 1f0aca8441c99498b3dbf9b5753bfec44469ae93 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Tue, 6 Jun 2023 20:51:19 +0800 Subject: [PATCH 2/3] GroupApplicationResponse --- internal/rpc/group/group.go | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index adcb236cc..a8d31a02c 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -761,30 +761,12 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup switch req.HandleResult { case constant.GroupResponseAgree: s.Notification.GroupApplicationAcceptedNotification(ctx, req) - if !inGroup { - groupMember := &relationTb.GroupMemberModel{} - groupMember.GroupID = group.GroupID - groupMember.UserID = req.FromUserID - groupMember.RoleLevel = constant.GroupOrdinaryUsers - groupMember.OperatorUserID = mcontext.GetOpUserID(ctx) - groupMember.JoinSource = groupRequest.JoinSource - groupMember.InviterUserID = groupRequest.InviterUserID - groupMember.JoinTime = time.Now() - groupMember.MuteEndTime = time.Unix(0, 0) - if err := CallbackBeforeMemberJoinGroup(ctx, groupMember, group.Ex); err != nil && err != errs.ErrCallbackContinue { - return nil, err - } - if err := s.GroupDatabase.CreateGroup(ctx, nil, []*relationTb.GroupMemberModel{groupMember}); err != nil { - return nil, err - } - if err := s.conversationRpcClient.GroupChatFirstCreateConversation(ctx, req.GroupID, []string{req.FromUserID}); err != nil { - return nil, err - } - s.Notification.MemberEnterNotification(ctx, req) - } case constant.GroupResponseRefuse: s.Notification.GroupApplicationRejectedNotification(ctx, req) } + if member != nil { + s.Notification.MemberEnterNotification(ctx, req) + } return &pbGroup.GroupApplicationResponseResp{}, nil } From 84ca9e560ccabb9c6d84d46259a909ec28b0fdae Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Tue, 6 Jun 2023 21:05:55 +0800 Subject: [PATCH 3/3] api log --- cmd/api/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/api/main.go b/cmd/api/main.go index 48ff83206..da479f045 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -38,6 +38,7 @@ func run(port int) error { if err != nil { return err } + fmt.Println("api start init discov client") var client discoveryregistry.SvcDiscoveryRegistry client, err = openKeeper.NewClient(config.Config.Zookeeper.ZkAddr, config.Config.Zookeeper.Schema, openKeeper.WithFreq(time.Hour), openKeeper.WithUserNameAndPassword(config.Config.Zookeeper.UserName, @@ -45,14 +46,18 @@ func run(port int) error { if err != nil { return err } + fmt.Println("api init discov client success") buf := bytes.NewBuffer(nil) if err := yaml.NewEncoder(buf).Encode(config.Config); err != nil { return err } + fmt.Println("api register public config to discov") if err := client.RegisterConf2Registry(constant.OpenIMCommonConfigKey, buf.Bytes()); err != nil { return err } + fmt.Println("api register public config to discov success") router := api.NewGinRouter(client, rdb) + fmt.Println("api init router success") var address string if config.Config.Api.ListenIP != "" { address = net.JoinHostPort(config.Config.Api.ListenIP, strconv.Itoa(port))