mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-25 11:06:43 +08:00
Merge remote-tracking branch 'origin/errcode' into errcode
This commit is contained in:
commit
b96707ea51
@ -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))
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user