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)) diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 84c13e88f..a8d31a02c 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -761,29 +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.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 }