mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-11-04 19:32:17 +08:00 
			
		
		
		
	feat: implement SetGroupInfoEX interface.
				
					
				
			This commit is contained in:
		
							parent
							
								
									41bd06aedd
								
							
						
					
					
						commit
						dfb10c43e8
					
				@ -130,6 +130,13 @@ beforeSetGroupInfo:
 | 
				
			|||||||
  enable: false
 | 
					  enable: false
 | 
				
			||||||
  timeout: 5
 | 
					  timeout: 5
 | 
				
			||||||
  failedContinue: true
 | 
					  failedContinue: true
 | 
				
			||||||
 | 
					afterSetGroupInfoEX:
 | 
				
			||||||
 | 
					  enable: false
 | 
				
			||||||
 | 
					  timeout: 5
 | 
				
			||||||
 | 
					beforeSetGroupInfoEX:
 | 
				
			||||||
 | 
					  enable: false
 | 
				
			||||||
 | 
					  timeout: 5
 | 
				
			||||||
 | 
					  failedContinue: true
 | 
				
			||||||
afterRevokeMsg:
 | 
					afterRevokeMsg:
 | 
				
			||||||
  enable: false
 | 
					  enable: false
 | 
				
			||||||
  timeout: 5
 | 
					  timeout: 5
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										5
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								go.mod
									
									
									
									
									
								
							@ -12,7 +12,7 @@ require (
 | 
				
			|||||||
	github.com/gorilla/websocket v1.5.1
 | 
						github.com/gorilla/websocket v1.5.1
 | 
				
			||||||
	github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
 | 
						github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
 | 
				
			||||||
	github.com/mitchellh/mapstructure v1.5.0
 | 
						github.com/mitchellh/mapstructure v1.5.0
 | 
				
			||||||
	github.com/openimsdk/protocol v0.0.69
 | 
						github.com/openimsdk/protocol v0.0.72-alpha.5
 | 
				
			||||||
	github.com/openimsdk/tools v0.0.49-alpha.55
 | 
						github.com/openimsdk/tools v0.0.49-alpha.55
 | 
				
			||||||
	github.com/pkg/errors v0.9.1 // indirect
 | 
						github.com/pkg/errors v0.9.1 // indirect
 | 
				
			||||||
	github.com/prometheus/client_golang v1.18.0
 | 
						github.com/prometheus/client_golang v1.18.0
 | 
				
			||||||
@ -41,6 +41,7 @@ require (
 | 
				
			|||||||
	github.com/spf13/viper v1.18.2
 | 
						github.com/spf13/viper v1.18.2
 | 
				
			||||||
	github.com/stathat/consistent v1.0.0
 | 
						github.com/stathat/consistent v1.0.0
 | 
				
			||||||
	go.uber.org/automaxprocs v1.5.3
 | 
						go.uber.org/automaxprocs v1.5.3
 | 
				
			||||||
 | 
						golang.org/x/exp v0.0.0-20230905200255-921286631fa9
 | 
				
			||||||
	golang.org/x/sync v0.6.0
 | 
						golang.org/x/sync v0.6.0
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -74,7 +75,6 @@ require (
 | 
				
			|||||||
	github.com/beorn7/perks v1.0.1 // indirect
 | 
						github.com/beorn7/perks v1.0.1 // indirect
 | 
				
			||||||
	github.com/bytedance/sonic v1.9.1 // indirect
 | 
						github.com/bytedance/sonic v1.9.1 // indirect
 | 
				
			||||||
	github.com/cespare/xxhash/v2 v2.2.0 // indirect
 | 
						github.com/cespare/xxhash/v2 v2.2.0 // indirect
 | 
				
			||||||
	github.com/chai2010/webp v1.1.1 // indirect
 | 
					 | 
				
			||||||
	github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
 | 
						github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
 | 
				
			||||||
	github.com/clbanning/mxj v1.8.4 // indirect
 | 
						github.com/clbanning/mxj v1.8.4 // indirect
 | 
				
			||||||
	github.com/coreos/go-semver v0.3.0 // indirect
 | 
						github.com/coreos/go-semver v0.3.0 // indirect
 | 
				
			||||||
@ -170,7 +170,6 @@ require (
 | 
				
			|||||||
	go.uber.org/atomic v1.9.0 // indirect
 | 
						go.uber.org/atomic v1.9.0 // indirect
 | 
				
			||||||
	go.uber.org/multierr v1.11.0 // indirect
 | 
						go.uber.org/multierr v1.11.0 // indirect
 | 
				
			||||||
	golang.org/x/arch v0.3.0 // indirect
 | 
						golang.org/x/arch v0.3.0 // indirect
 | 
				
			||||||
	golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
 | 
					 | 
				
			||||||
	golang.org/x/image v0.15.0 // indirect
 | 
						golang.org/x/image v0.15.0 // indirect
 | 
				
			||||||
	golang.org/x/net v0.22.0 // indirect
 | 
						golang.org/x/net v0.22.0 // indirect
 | 
				
			||||||
	golang.org/x/oauth2 v0.17.0 // indirect
 | 
						golang.org/x/oauth2 v0.17.0 // indirect
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								go.sum
									
									
									
									
									
								
							@ -71,8 +71,6 @@ github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZX
 | 
				
			|||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
 | 
					github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
 | 
				
			||||||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
 | 
					github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
 | 
				
			||||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
 | 
					github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
 | 
				
			||||||
github.com/chai2010/webp v1.1.1 h1:jTRmEccAJ4MGrhFOrPMpNGIJ/eybIgwKpcACsrTEapk=
 | 
					 | 
				
			||||||
github.com/chai2010/webp v1.1.1/go.mod h1:0XVwvZWdjjdxpUEIf7b9g9VkHFnInUSYujwqTLEuldU=
 | 
					 | 
				
			||||||
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
 | 
					github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
 | 
				
			||||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams=
 | 
					github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams=
 | 
				
			||||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
 | 
					github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
 | 
				
			||||||
@ -321,8 +319,8 @@ github.com/onsi/gomega v1.25.0 h1:Vw7br2PCDYijJHSfBOWhov+8cAnUf8MfMaIOV323l6Y=
 | 
				
			|||||||
github.com/onsi/gomega v1.25.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM=
 | 
					github.com/onsi/gomega v1.25.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM=
 | 
				
			||||||
github.com/openimsdk/gomake v0.0.14-alpha.5 h1:VY9c5x515lTfmdhhPjMvR3BBRrRquAUCFsz7t7vbv7Y=
 | 
					github.com/openimsdk/gomake v0.0.14-alpha.5 h1:VY9c5x515lTfmdhhPjMvR3BBRrRquAUCFsz7t7vbv7Y=
 | 
				
			||||||
github.com/openimsdk/gomake v0.0.14-alpha.5/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI=
 | 
					github.com/openimsdk/gomake v0.0.14-alpha.5/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI=
 | 
				
			||||||
github.com/openimsdk/protocol v0.0.69 h1:dVi8meSg8kmUzSH1XQab4MjihqKkkcCAmt1BYXPJuXo=
 | 
					github.com/openimsdk/protocol v0.0.72-alpha.5 h1:1Xjyx6ivTb782Sm7wMJXCLZP80iXADVo1CySis1rOG0=
 | 
				
			||||||
github.com/openimsdk/protocol v0.0.69/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8=
 | 
					github.com/openimsdk/protocol v0.0.72-alpha.5/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8=
 | 
				
			||||||
github.com/openimsdk/tools v0.0.49-alpha.55 h1:KPgC53oqiwZYssLKljhtXbWXifMlTj2SSQEusj4Uf4k=
 | 
					github.com/openimsdk/tools v0.0.49-alpha.55 h1:KPgC53oqiwZYssLKljhtXbWXifMlTj2SSQEusj4Uf4k=
 | 
				
			||||||
github.com/openimsdk/tools v0.0.49-alpha.55/go.mod h1:h1cYmfyaVtgFbKmb1Cfsl8XwUOMTt8ubVUQrdGtsUh4=
 | 
					github.com/openimsdk/tools v0.0.49-alpha.55/go.mod h1:h1cYmfyaVtgFbKmb1Cfsl8XwUOMTt8ubVUQrdGtsUh4=
 | 
				
			||||||
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
 | 
					github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
 | 
				
			||||||
 | 
				
			|||||||
@ -35,6 +35,10 @@ func (o *GroupApi) SetGroupInfo(c *gin.Context) {
 | 
				
			|||||||
	a2r.Call(group.GroupClient.SetGroupInfo, o.Client, c)
 | 
						a2r.Call(group.GroupClient.SetGroupInfo, o.Client, c)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (o *GroupApi) SetGroupInfoEX(c *gin.Context) {
 | 
				
			||||||
 | 
						a2r.Call(group.GroupClient.SetGroupInfoEX, o.Client, c)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (o *GroupApi) JoinGroup(c *gin.Context) {
 | 
					func (o *GroupApi) JoinGroup(c *gin.Context) {
 | 
				
			||||||
	a2r.Call(group.GroupClient.JoinGroup, o.Client, c)
 | 
						a2r.Call(group.GroupClient.JoinGroup, o.Client, c)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -36,9 +36,11 @@ func (u *UserApi) UserRegister(c *gin.Context) {
 | 
				
			|||||||
	a2r.Call(user.UserClient.UserRegister, u.Client, c)
 | 
						a2r.Call(user.UserClient.UserRegister, u.Client, c)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// UpdateUserInfo is deprecated. Use UpdateUserInfoEx
 | 
				
			||||||
func (u *UserApi) UpdateUserInfo(c *gin.Context) {
 | 
					func (u *UserApi) UpdateUserInfo(c *gin.Context) {
 | 
				
			||||||
	a2r.Call(user.UserClient.UpdateUserInfo, u.Client, c)
 | 
						a2r.Call(user.UserClient.UpdateUserInfo, u.Client, c)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (u *UserApi) UpdateUserInfoEx(c *gin.Context) {
 | 
					func (u *UserApi) UpdateUserInfoEx(c *gin.Context) {
 | 
				
			||||||
	a2r.Call(user.UserClient.UpdateUserInfoEx, u.Client, c)
 | 
						a2r.Call(user.UserClient.UpdateUserInfoEx, u.Client, c)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -703,3 +703,9 @@ func (c *conversationServer) GetConversationsNeedDestructMsgs(ctx context.Contex
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	return &pbconversation.GetConversationsNeedDestructMsgsResp{Conversations: convert.ConversationsDB2Pb(temp)}, nil
 | 
						return &pbconversation.GetConversationsNeedDestructMsgsResp{Conversations: convert.ConversationsDB2Pb(temp)}, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// SetConversationMinSeq implements conversation.ConversationServer.
 | 
				
			||||||
 | 
					func (c *conversationServer) SetConversationMinSeq(context.Context, *pbconversation.SetConversationMinSeqReq) (*pbconversation.SetConversationMinSeqResp, error) {
 | 
				
			||||||
 | 
						_ = c.config
 | 
				
			||||||
 | 
						panic("unimplemented")
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -358,3 +358,74 @@ func (s *groupServer) webhookAfterSetGroupInfo(ctx context.Context, after *confi
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	s.webhookClient.AsyncPost(ctx, cbReq.GetCallbackCommand(), cbReq, &callbackstruct.CallbackAfterSetGroupInfoResp{}, after)
 | 
						s.webhookClient.AsyncPost(ctx, cbReq.GetCallbackCommand(), cbReq, &callbackstruct.CallbackAfterSetGroupInfoResp{}, after)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (s *groupServer) webhookBeforeSetGroupInfoEX(ctx context.Context, before *config.BeforeConfig, req *group.SetGroupInfoEXReq) error {
 | 
				
			||||||
 | 
						return webhook.WithCondition(ctx, before, func(ctx context.Context) error {
 | 
				
			||||||
 | 
							cbReq := &callbackstruct.CallbackBeforeSetGroupInfoEXReq{
 | 
				
			||||||
 | 
								CallbackCommand: callbackstruct.CallbackBeforeSetGroupInfoCommand,
 | 
				
			||||||
 | 
								GroupID:         req.GroupInfoForSetEX.GroupID,
 | 
				
			||||||
 | 
								GroupName:       req.GroupInfoForSetEX.GroupName,
 | 
				
			||||||
 | 
								Notification:    req.GroupInfoForSetEX.Notification,
 | 
				
			||||||
 | 
								Introduction:    req.GroupInfoForSetEX.Introduction,
 | 
				
			||||||
 | 
								FaceURL:         req.GroupInfoForSetEX.FaceURL,
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if req.GroupInfoForSetEX.Ex != nil {
 | 
				
			||||||
 | 
								cbReq.Ex = req.GroupInfoForSetEX.Ex
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							log.ZDebug(ctx, "debug CallbackBeforeSetGroupInfoEX", "ex", cbReq.Ex)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if req.GroupInfoForSetEX.NeedVerification != nil {
 | 
				
			||||||
 | 
								cbReq.NeedVerification = req.GroupInfoForSetEX.NeedVerification
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if req.GroupInfoForSetEX.LookMemberInfo != nil {
 | 
				
			||||||
 | 
								cbReq.LookMemberInfo = req.GroupInfoForSetEX.LookMemberInfo
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if req.GroupInfoForSetEX.ApplyMemberFriend != nil {
 | 
				
			||||||
 | 
								cbReq.ApplyMemberFriend = req.GroupInfoForSetEX.ApplyMemberFriend
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							resp := &callbackstruct.CallbackBeforeSetGroupInfoEXResp{}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if err := s.webhookClient.SyncPost(ctx, cbReq.GetCallbackCommand(), cbReq, resp, before); err != nil {
 | 
				
			||||||
 | 
								return err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							datautil.NotNilReplace(&req.GroupInfoForSetEX.GroupID, &resp.GroupID)
 | 
				
			||||||
 | 
							datautil.NotNilReplace(&req.GroupInfoForSetEX.GroupName, &resp.GroupName)
 | 
				
			||||||
 | 
							datautil.NotNilReplace(&req.GroupInfoForSetEX.FaceURL, &resp.FaceURL)
 | 
				
			||||||
 | 
							datautil.NotNilReplace(&req.GroupInfoForSetEX.Introduction, &resp.Introduction)
 | 
				
			||||||
 | 
							datautil.NotNilReplace(&req.GroupInfoForSetEX.Ex, &resp.Ex)
 | 
				
			||||||
 | 
							datautil.NotNilReplace(&req.GroupInfoForSetEX.NeedVerification, &resp.NeedVerification)
 | 
				
			||||||
 | 
							datautil.NotNilReplace(&req.GroupInfoForSetEX.LookMemberInfo, &resp.LookMemberInfo)
 | 
				
			||||||
 | 
							datautil.NotNilReplace(&req.GroupInfoForSetEX.ApplyMemberFriend, &resp.ApplyMemberFriend)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (s *groupServer) webhookAfterSetGroupInfoEX(ctx context.Context, after *config.AfterConfig, req *group.SetGroupInfoEXReq) {
 | 
				
			||||||
 | 
						cbReq := &callbackstruct.CallbackAfterSetGroupInfoEXReq{
 | 
				
			||||||
 | 
							CallbackCommand: callbackstruct.CallbackAfterSetGroupInfoCommand,
 | 
				
			||||||
 | 
							GroupID:         req.GroupInfoForSetEX.GroupID,
 | 
				
			||||||
 | 
							GroupName:       req.GroupInfoForSetEX.GroupName,
 | 
				
			||||||
 | 
							Notification:    req.GroupInfoForSetEX.Notification,
 | 
				
			||||||
 | 
							Introduction:    req.GroupInfoForSetEX.Introduction,
 | 
				
			||||||
 | 
							FaceURL:         req.GroupInfoForSetEX.FaceURL,
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if req.GroupInfoForSetEX.Ex != nil {
 | 
				
			||||||
 | 
							cbReq.Ex = req.GroupInfoForSetEX.Ex
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if req.GroupInfoForSetEX.NeedVerification != nil {
 | 
				
			||||||
 | 
							cbReq.NeedVerification = req.GroupInfoForSetEX.NeedVerification
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if req.GroupInfoForSetEX.LookMemberInfo != nil {
 | 
				
			||||||
 | 
							cbReq.LookMemberInfo = req.GroupInfoForSetEX.LookMemberInfo
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if req.GroupInfoForSetEX.ApplyMemberFriend != nil {
 | 
				
			||||||
 | 
							cbReq.ApplyMemberFriend = req.GroupInfoForSetEX.ApplyMemberFriend
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						s.webhookClient.AsyncPost(ctx, cbReq.GetCallbackCommand(), cbReq, &callbackstruct.CallbackAfterSetGroupInfoEXResp{}, after)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -54,6 +54,39 @@ func UpdateGroupInfoMap(ctx context.Context, group *sdkws.GroupInfoForSet) map[s
 | 
				
			|||||||
	return m
 | 
						return m
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func UpdateGroupInfoEXMap(ctx context.Context, group *sdkws.GroupInfoForSetEX) map[string]any {
 | 
				
			||||||
 | 
						m := make(map[string]any)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if group.GroupName != "" {
 | 
				
			||||||
 | 
							m["group_name"] = group.GroupName
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if group.Notification != nil {
 | 
				
			||||||
 | 
							m["notification"] = group.Notification.Value
 | 
				
			||||||
 | 
							m["notification_update_time"] = time.Now()
 | 
				
			||||||
 | 
							m["notification_user_id"] = mcontext.GetOpUserID(ctx)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if group.Introduction != nil {
 | 
				
			||||||
 | 
							m["introduction"] = group.Introduction.Value
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if group.FaceURL != nil {
 | 
				
			||||||
 | 
							m["face_url"] = group.FaceURL.Value
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if group.NeedVerification != nil {
 | 
				
			||||||
 | 
							m["need_verification"] = group.NeedVerification.Value
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if group.LookMemberInfo != nil {
 | 
				
			||||||
 | 
							m["look_member_info"] = group.LookMemberInfo.Value
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if group.ApplyMemberFriend != nil {
 | 
				
			||||||
 | 
							m["apply_member_friend"] = group.ApplyMemberFriend.Value
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if group.Ex != nil {
 | 
				
			||||||
 | 
							m["ex"] = group.Ex.Value
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return m
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func UpdateGroupStatusMap(status int) map[string]any {
 | 
					func UpdateGroupStatusMap(status int) map[string]any {
 | 
				
			||||||
	return map[string]any{
 | 
						return map[string]any{
 | 
				
			||||||
		"status": status,
 | 
							"status": status,
 | 
				
			||||||
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -17,6 +17,11 @@ package user
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"context"
 | 
						"context"
 | 
				
			||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
 | 
						"math/rand"
 | 
				
			||||||
 | 
						"strings"
 | 
				
			||||||
 | 
						"sync"
 | 
				
			||||||
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/openimsdk/open-im-server/v3/internal/rpc/relation"
 | 
						"github.com/openimsdk/open-im-server/v3/internal/rpc/relation"
 | 
				
			||||||
	"github.com/openimsdk/open-im-server/v3/pkg/common/config"
 | 
						"github.com/openimsdk/open-im-server/v3/pkg/common/config"
 | 
				
			||||||
	"github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics"
 | 
						"github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics"
 | 
				
			||||||
@ -29,10 +34,6 @@ import (
 | 
				
			|||||||
	"github.com/openimsdk/protocol/group"
 | 
						"github.com/openimsdk/protocol/group"
 | 
				
			||||||
	friendpb "github.com/openimsdk/protocol/relation"
 | 
						friendpb "github.com/openimsdk/protocol/relation"
 | 
				
			||||||
	"github.com/openimsdk/tools/db/redisutil"
 | 
						"github.com/openimsdk/tools/db/redisutil"
 | 
				
			||||||
	"math/rand"
 | 
					 | 
				
			||||||
	"strings"
 | 
					 | 
				
			||||||
	"sync"
 | 
					 | 
				
			||||||
	"time"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/openimsdk/open-im-server/v3/pkg/authverify"
 | 
						"github.com/openimsdk/open-im-server/v3/pkg/authverify"
 | 
				
			||||||
	"github.com/openimsdk/open-im-server/v3/pkg/common/convert"
 | 
						"github.com/openimsdk/open-im-server/v3/pkg/common/convert"
 | 
				
			||||||
@ -147,41 +148,35 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserI
 | 
				
			|||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	s.friendNotificationSender.UserInfoUpdatedNotification(ctx, req.UserInfo.UserID)
 | 
						s.friendNotificationSender.UserInfoUpdatedNotification(ctx, req.UserInfo.UserID)
 | 
				
			||||||
	//friends, err := s.friendRpcClient.GetFriendIDs(ctx, req.UserInfo.UserID)
 | 
					
 | 
				
			||||||
	//if err != nil {
 | 
					 | 
				
			||||||
	//	return nil, err
 | 
					 | 
				
			||||||
	//}
 | 
					 | 
				
			||||||
	//if req.UserInfo.Nickname != "" || req.UserInfo.FaceURL != "" {
 | 
					 | 
				
			||||||
	//	if err = s.NotificationUserInfoUpdate(ctx, req.UserInfo.UserID,oldUser); err != nil {
 | 
					 | 
				
			||||||
	//		return nil, err
 | 
					 | 
				
			||||||
	//	}
 | 
					 | 
				
			||||||
	//}
 | 
					 | 
				
			||||||
	//for _, friendID := range friends {
 | 
					 | 
				
			||||||
	//	s.friendNotificationSender.FriendInfoUpdatedNotification(ctx, req.UserInfo.UserID, friendID)
 | 
					 | 
				
			||||||
	//}
 | 
					 | 
				
			||||||
	s.webhookAfterUpdateUserInfo(ctx, &s.config.WebhooksConfig.AfterUpdateUserInfo, req)
 | 
						s.webhookAfterUpdateUserInfo(ctx, &s.config.WebhooksConfig.AfterUpdateUserInfo, req)
 | 
				
			||||||
	if err = s.NotificationUserInfoUpdate(ctx, req.UserInfo.UserID, oldUser); err != nil {
 | 
						if err = s.NotificationUserInfoUpdate(ctx, req.UserInfo.UserID, oldUser); err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return resp, nil
 | 
						return resp, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *userServer) UpdateUserInfoEx(ctx context.Context, req *pbuser.UpdateUserInfoExReq) (resp *pbuser.UpdateUserInfoExResp, err error) {
 | 
					func (s *userServer) UpdateUserInfoEx(ctx context.Context, req *pbuser.UpdateUserInfoExReq) (resp *pbuser.UpdateUserInfoExResp, err error) {
 | 
				
			||||||
	resp = &pbuser.UpdateUserInfoExResp{}
 | 
						resp = &pbuser.UpdateUserInfoExResp{}
 | 
				
			||||||
	err = authverify.CheckAccessV3(ctx, req.UserInfo.UserID, s.config.Share.IMAdminUserID)
 | 
						err = authverify.CheckAccessV3(ctx, req.UserInfo.UserID, s.config.Share.IMAdminUserID)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err = s.webhookBeforeUpdateUserInfoEx(ctx, &s.config.WebhooksConfig.BeforeUpdateUserInfoEx, req); err != nil {
 | 
						if err = s.webhookBeforeUpdateUserInfoEx(ctx, &s.config.WebhooksConfig.BeforeUpdateUserInfoEx, req); err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	oldUser, err := s.db.GetUserByID(ctx, req.UserInfo.UserID)
 | 
						oldUser, err := s.db.GetUserByID(ctx, req.UserInfo.UserID)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	data := convert.UserPb2DBMapEx(req.UserInfo)
 | 
						data := convert.UserPb2DBMapEx(req.UserInfo)
 | 
				
			||||||
	if err = s.db.UpdateByMap(ctx, req.UserInfo.UserID, data); err != nil {
 | 
						if err = s.db.UpdateByMap(ctx, req.UserInfo.UserID, data); err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	s.friendNotificationSender.UserInfoUpdatedNotification(ctx, req.UserInfo.UserID)
 | 
						s.friendNotificationSender.UserInfoUpdatedNotification(ctx, req.UserInfo.UserID)
 | 
				
			||||||
	//friends, err := s.friendRpcClient.GetFriendIDs(ctx, req.UserInfo.UserID)
 | 
						//friends, err := s.friendRpcClient.GetFriendIDs(ctx, req.UserInfo.UserID)
 | 
				
			||||||
	//if err != nil {
 | 
						//if err != nil {
 | 
				
			||||||
@ -199,6 +194,7 @@ func (s *userServer) UpdateUserInfoEx(ctx context.Context, req *pbuser.UpdateUse
 | 
				
			|||||||
	if err := s.NotificationUserInfoUpdate(ctx, req.UserInfo.UserID, oldUser); err != nil {
 | 
						if err := s.NotificationUserInfoUpdate(ctx, req.UserInfo.UserID, oldUser); err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return resp, nil
 | 
						return resp, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
func (s *userServer) SetGlobalRecvMessageOpt(ctx context.Context, req *pbuser.SetGlobalRecvMessageOptReq) (resp *pbuser.SetGlobalRecvMessageOptResp, err error) {
 | 
					func (s *userServer) SetGlobalRecvMessageOpt(ctx context.Context, req *pbuser.SetGlobalRecvMessageOptReq) (resp *pbuser.SetGlobalRecvMessageOptResp, err error) {
 | 
				
			||||||
 | 
				
			|||||||
@ -18,7 +18,9 @@ const (
 | 
				
			|||||||
	CallbackBeforeInviteJoinGroupCommand    = "callbackBeforeInviteJoinGroupCommand"
 | 
						CallbackBeforeInviteJoinGroupCommand    = "callbackBeforeInviteJoinGroupCommand"
 | 
				
			||||||
	CallbackAfterJoinGroupCommand           = "callbackAfterJoinGroupCommand"
 | 
						CallbackAfterJoinGroupCommand           = "callbackAfterJoinGroupCommand"
 | 
				
			||||||
	CallbackAfterSetGroupInfoCommand        = "callbackAfterSetGroupInfoCommand"
 | 
						CallbackAfterSetGroupInfoCommand        = "callbackAfterSetGroupInfoCommand"
 | 
				
			||||||
 | 
						CallbackAfterSetGroupInfoEXCommand      = "callbackAfterSetGroupInfoCommandEX"
 | 
				
			||||||
	CallbackBeforeSetGroupInfoCommand       = "callbackBeforeSetGroupInfoCommand"
 | 
						CallbackBeforeSetGroupInfoCommand       = "callbackBeforeSetGroupInfoCommand"
 | 
				
			||||||
 | 
						CallbackBeforeSetGroupInfoEXCommand     = "callbackBeforeSetGroupInfoEXCommand"
 | 
				
			||||||
	CallbackAfterRevokeMsgCommand           = "callbackBeforeAfterMsgCommand"
 | 
						CallbackAfterRevokeMsgCommand           = "callbackBeforeAfterMsgCommand"
 | 
				
			||||||
	CallbackBeforeAddBlackCommand           = "callbackBeforeAddBlackCommand"
 | 
						CallbackBeforeAddBlackCommand           = "callbackBeforeAddBlackCommand"
 | 
				
			||||||
	CallbackAfterAddFriendCommand           = "callbackAfterAddFriendCommand"
 | 
						CallbackAfterAddFriendCommand           = "callbackAfterAddFriendCommand"
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,7 @@ package callbackstruct
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"github.com/openimsdk/open-im-server/v3/pkg/apistruct"
 | 
						"github.com/openimsdk/open-im-server/v3/pkg/apistruct"
 | 
				
			||||||
	common "github.com/openimsdk/protocol/sdkws"
 | 
						common "github.com/openimsdk/protocol/sdkws"
 | 
				
			||||||
 | 
						"github.com/openimsdk/protocol/wrapperspb"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type CallbackCommand string
 | 
					type CallbackCommand string
 | 
				
			||||||
@ -242,3 +243,48 @@ type CallbackAfterSetGroupInfoReq struct {
 | 
				
			|||||||
type CallbackAfterSetGroupInfoResp struct {
 | 
					type CallbackAfterSetGroupInfoResp struct {
 | 
				
			||||||
	CommonCallbackResp
 | 
						CommonCallbackResp
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type CallbackBeforeSetGroupInfoEXReq struct {
 | 
				
			||||||
 | 
						CallbackCommand   `json:"callbackCommand"`
 | 
				
			||||||
 | 
						OperationID       string                  `json:"operationID"`
 | 
				
			||||||
 | 
						GroupID           string                  `json:"groupID"`
 | 
				
			||||||
 | 
						GroupName         string                  `json:"groupName"`
 | 
				
			||||||
 | 
						Notification      *wrapperspb.StringValue `json:"notification"`
 | 
				
			||||||
 | 
						Introduction      *wrapperspb.StringValue `json:"introduction"`
 | 
				
			||||||
 | 
						FaceURL           *wrapperspb.StringValue `json:"faceURL"`
 | 
				
			||||||
 | 
						Ex                *wrapperspb.StringValue `json:"ex"`
 | 
				
			||||||
 | 
						NeedVerification  *wrapperspb.Int32Value  `json:"needVerification"`
 | 
				
			||||||
 | 
						LookMemberInfo    *wrapperspb.Int32Value  `json:"lookMemberInfo"`
 | 
				
			||||||
 | 
						ApplyMemberFriend *wrapperspb.Int32Value  `json:"applyMemberFriend"`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type CallbackBeforeSetGroupInfoEXResp struct {
 | 
				
			||||||
 | 
						CommonCallbackResp
 | 
				
			||||||
 | 
						GroupID           string                  `json:"groupID"`
 | 
				
			||||||
 | 
						GroupName         string                  `json:"groupName"`
 | 
				
			||||||
 | 
						Notification      *wrapperspb.StringValue `json:"notification"`
 | 
				
			||||||
 | 
						Introduction      *wrapperspb.StringValue `json:"introduction"`
 | 
				
			||||||
 | 
						FaceURL           *wrapperspb.StringValue `json:"faceURL"`
 | 
				
			||||||
 | 
						Ex                *wrapperspb.StringValue `json:"ex"`
 | 
				
			||||||
 | 
						NeedVerification  *wrapperspb.Int32Value  `json:"needVerification"`
 | 
				
			||||||
 | 
						LookMemberInfo    *wrapperspb.Int32Value  `json:"lookMemberInfo"`
 | 
				
			||||||
 | 
						ApplyMemberFriend *wrapperspb.Int32Value  `json:"applyMemberFriend"`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type CallbackAfterSetGroupInfoEXReq struct {
 | 
				
			||||||
 | 
						CallbackCommand   `json:"callbackCommand"`
 | 
				
			||||||
 | 
						OperationID       string                  `json:"operationID"`
 | 
				
			||||||
 | 
						GroupID           string                  `json:"groupID"`
 | 
				
			||||||
 | 
						GroupName         string                  `json:"groupName"`
 | 
				
			||||||
 | 
						Notification      *wrapperspb.StringValue `json:"notification"`
 | 
				
			||||||
 | 
						Introduction      *wrapperspb.StringValue `json:"introduction"`
 | 
				
			||||||
 | 
						FaceURL           *wrapperspb.StringValue `json:"faceURL"`
 | 
				
			||||||
 | 
						Ex                *wrapperspb.StringValue `json:"ex"`
 | 
				
			||||||
 | 
						NeedVerification  *wrapperspb.Int32Value  `json:"needVerification"`
 | 
				
			||||||
 | 
						LookMemberInfo    *wrapperspb.Int32Value  `json:"lookMemberInfo"`
 | 
				
			||||||
 | 
						ApplyMemberFriend *wrapperspb.Int32Value  `json:"applyMemberFriend"`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type CallbackAfterSetGroupInfoEXResp struct {
 | 
				
			||||||
 | 
						CommonCallbackResp
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -421,6 +421,8 @@ type Webhooks struct {
 | 
				
			|||||||
	BeforeInviteUserToGroup  BeforeConfig `mapstructure:"beforeInviteUserToGroup"`
 | 
						BeforeInviteUserToGroup  BeforeConfig `mapstructure:"beforeInviteUserToGroup"`
 | 
				
			||||||
	AfterSetGroupInfo        AfterConfig  `mapstructure:"afterSetGroupInfo"`
 | 
						AfterSetGroupInfo        AfterConfig  `mapstructure:"afterSetGroupInfo"`
 | 
				
			||||||
	BeforeSetGroupInfo       BeforeConfig `mapstructure:"beforeSetGroupInfo"`
 | 
						BeforeSetGroupInfo       BeforeConfig `mapstructure:"beforeSetGroupInfo"`
 | 
				
			||||||
 | 
						AfterSetGroupInfoEX      AfterConfig  `mapstructure:"afterSetGroupInfoEX"`
 | 
				
			||||||
 | 
						BeforeSetGroupInfoEX     BeforeConfig `mapstructure:"beforeSetGroupInfoEX"`
 | 
				
			||||||
	AfterRevokeMsg           AfterConfig  `mapstructure:"afterRevokeMsg"`
 | 
						AfterRevokeMsg           AfterConfig  `mapstructure:"afterRevokeMsg"`
 | 
				
			||||||
	BeforeAddBlack           BeforeConfig `mapstructure:"beforeAddBlack"`
 | 
						BeforeAddBlack           BeforeConfig `mapstructure:"beforeAddBlack"`
 | 
				
			||||||
	AfterAddFriend           AfterConfig  `mapstructure:"afterAddFriend"`
 | 
						AfterAddFriend           AfterConfig  `mapstructure:"afterAddFriend"`
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user