|
|
@ -20,6 +20,7 @@ import (
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
|
|
|
|
"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/db/table/relation"
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation"
|
|
|
|
|
|
|
|
"github.com/openimsdk/open-im-server/v3/pkg/common/webhook"
|
|
|
|
"github.com/openimsdk/protocol/constant"
|
|
|
|
"github.com/openimsdk/protocol/constant"
|
|
|
|
"github.com/openimsdk/protocol/group"
|
|
|
|
"github.com/openimsdk/protocol/group"
|
|
|
|
"github.com/openimsdk/protocol/wrapperspb"
|
|
|
|
"github.com/openimsdk/protocol/wrapperspb"
|
|
|
@ -31,46 +32,48 @@ import (
|
|
|
|
|
|
|
|
|
|
|
|
// CallbackBeforeCreateGroup callback before create group.
|
|
|
|
// CallbackBeforeCreateGroup callback before create group.
|
|
|
|
func (s *groupServer) webhookBeforeCreateGroup(ctx context.Context, before *config.BeforeConfig, req *group.CreateGroupReq) error {
|
|
|
|
func (s *groupServer) webhookBeforeCreateGroup(ctx context.Context, before *config.BeforeConfig, req *group.CreateGroupReq) error {
|
|
|
|
cbReq := &callbackstruct.CallbackBeforeCreateGroupReq{
|
|
|
|
return webhook.WithCondition(ctx, before, func(ctx context.Context) error {
|
|
|
|
CallbackCommand: callbackstruct.CallbackBeforeCreateGroupCommand,
|
|
|
|
cbReq := &callbackstruct.CallbackBeforeCreateGroupReq{
|
|
|
|
OperationID: mcontext.GetOperationID(ctx),
|
|
|
|
CallbackCommand: callbackstruct.CallbackBeforeCreateGroupCommand,
|
|
|
|
GroupInfo: req.GroupInfo,
|
|
|
|
OperationID: mcontext.GetOperationID(ctx),
|
|
|
|
}
|
|
|
|
GroupInfo: req.GroupInfo,
|
|
|
|
cbReq.InitMemberList = append(cbReq.InitMemberList, &apistruct.GroupAddMemberInfo{
|
|
|
|
}
|
|
|
|
UserID: req.OwnerUserID,
|
|
|
|
|
|
|
|
RoleLevel: constant.GroupOwner,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
for _, userID := range req.AdminUserIDs {
|
|
|
|
|
|
|
|
cbReq.InitMemberList = append(cbReq.InitMemberList, &apistruct.GroupAddMemberInfo{
|
|
|
|
cbReq.InitMemberList = append(cbReq.InitMemberList, &apistruct.GroupAddMemberInfo{
|
|
|
|
UserID: userID,
|
|
|
|
UserID: req.OwnerUserID,
|
|
|
|
RoleLevel: constant.GroupAdmin,
|
|
|
|
RoleLevel: constant.GroupOwner,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
for _, userID := range req.AdminUserIDs {
|
|
|
|
for _, userID := range req.MemberUserIDs {
|
|
|
|
cbReq.InitMemberList = append(cbReq.InitMemberList, &apistruct.GroupAddMemberInfo{
|
|
|
|
cbReq.InitMemberList = append(cbReq.InitMemberList, &apistruct.GroupAddMemberInfo{
|
|
|
|
UserID: userID,
|
|
|
|
UserID: userID,
|
|
|
|
RoleLevel: constant.GroupAdmin,
|
|
|
|
RoleLevel: constant.GroupOrdinaryUsers,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _, userID := range req.MemberUserIDs {
|
|
|
|
resp := &callbackstruct.CallbackBeforeCreateGroupResp{}
|
|
|
|
cbReq.InitMemberList = append(cbReq.InitMemberList, &apistruct.GroupAddMemberInfo{
|
|
|
|
|
|
|
|
UserID: userID,
|
|
|
|
|
|
|
|
RoleLevel: constant.GroupOrdinaryUsers,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
resp := &callbackstruct.CallbackBeforeCreateGroupResp{}
|
|
|
|
|
|
|
|
|
|
|
|
if err := s.webhookClient.SyncPost(ctx, cbReq.GetCallbackCommand(), cbReq, resp, before); err != nil {
|
|
|
|
if err := s.webhookClient.SyncPost(ctx, cbReq.GetCallbackCommand(), cbReq, resp, before); err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.GroupID, resp.GroupID)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.GroupID, resp.GroupID)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.GroupName, resp.GroupName)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.GroupName, resp.GroupName)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.Notification, resp.Notification)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.Notification, resp.Notification)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.Introduction, resp.Introduction)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.Introduction, resp.Introduction)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.FaceURL, resp.FaceURL)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.FaceURL, resp.FaceURL)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.OwnerUserID, resp.OwnerUserID)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.OwnerUserID, resp.OwnerUserID)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.Ex, resp.Ex)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.Ex, resp.Ex)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.Status, resp.Status)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.Status, resp.Status)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.CreatorUserID, resp.CreatorUserID)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.CreatorUserID, resp.CreatorUserID)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.GroupType, resp.GroupType)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.GroupType, resp.GroupType)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.NeedVerification, resp.NeedVerification)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.NeedVerification, resp.NeedVerification)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.LookMemberInfo, resp.LookMemberInfo)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfo.LookMemberInfo, resp.LookMemberInfo)
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (s *groupServer) webhookAfterCreateGroup(ctx context.Context, after *config.AfterConfig, req *group.CreateGroupReq) {
|
|
|
|
func (s *groupServer) webhookAfterCreateGroup(ctx context.Context, after *config.AfterConfig, req *group.CreateGroupReq) {
|
|
|
@ -98,63 +101,67 @@ func (s *groupServer) webhookAfterCreateGroup(ctx context.Context, after *config
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (s *groupServer) webhookBeforeMemberJoinGroup(ctx context.Context, before *config.BeforeConfig, groupMember *relation.GroupMemberModel, groupEx string) error {
|
|
|
|
func (s *groupServer) webhookBeforeMemberJoinGroup(ctx context.Context, before *config.BeforeConfig, groupMember *relation.GroupMemberModel, groupEx string) error {
|
|
|
|
cbReq := &callbackstruct.CallbackBeforeMemberJoinGroupReq{
|
|
|
|
return webhook.WithCondition(ctx, before, func(ctx context.Context) error {
|
|
|
|
CallbackCommand: callbackstruct.CallbackBeforeMemberJoinGroupCommand,
|
|
|
|
cbReq := &callbackstruct.CallbackBeforeMemberJoinGroupReq{
|
|
|
|
GroupID: groupMember.GroupID,
|
|
|
|
CallbackCommand: callbackstruct.CallbackBeforeMemberJoinGroupCommand,
|
|
|
|
UserID: groupMember.UserID,
|
|
|
|
GroupID: groupMember.GroupID,
|
|
|
|
Ex: groupMember.Ex,
|
|
|
|
UserID: groupMember.UserID,
|
|
|
|
GroupEx: groupEx,
|
|
|
|
Ex: groupMember.Ex,
|
|
|
|
}
|
|
|
|
GroupEx: groupEx,
|
|
|
|
resp := &callbackstruct.CallbackBeforeMemberJoinGroupResp{}
|
|
|
|
}
|
|
|
|
if err := s.webhookClient.SyncPost(ctx, cbReq.GetCallbackCommand(), cbReq, resp, before); err != nil {
|
|
|
|
resp := &callbackstruct.CallbackBeforeMemberJoinGroupResp{}
|
|
|
|
return err
|
|
|
|
if err := s.webhookClient.SyncPost(ctx, cbReq.GetCallbackCommand(), cbReq, resp, before); err != nil {
|
|
|
|
}
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if resp.MuteEndTime != nil {
|
|
|
|
if resp.MuteEndTime != nil {
|
|
|
|
groupMember.MuteEndTime = time.UnixMilli(*resp.MuteEndTime)
|
|
|
|
groupMember.MuteEndTime = time.UnixMilli(*resp.MuteEndTime)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
datautil.NotNilReplace(&groupMember.FaceURL, resp.FaceURL)
|
|
|
|
datautil.NotNilReplace(&groupMember.FaceURL, resp.FaceURL)
|
|
|
|
datautil.NotNilReplace(&groupMember.Ex, resp.Ex)
|
|
|
|
datautil.NotNilReplace(&groupMember.Ex, resp.Ex)
|
|
|
|
datautil.NotNilReplace(&groupMember.Nickname, resp.Nickname)
|
|
|
|
datautil.NotNilReplace(&groupMember.Nickname, resp.Nickname)
|
|
|
|
datautil.NotNilReplace(&groupMember.RoleLevel, resp.RoleLevel)
|
|
|
|
datautil.NotNilReplace(&groupMember.RoleLevel, resp.RoleLevel)
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (s *groupServer) webhookBeforeSetGroupMemberInfo(ctx context.Context, before *config.BeforeConfig, req *group.SetGroupMemberInfo) error {
|
|
|
|
func (s *groupServer) webhookBeforeSetGroupMemberInfo(ctx context.Context, before *config.BeforeConfig, req *group.SetGroupMemberInfo) error {
|
|
|
|
cbReq := callbackstruct.CallbackBeforeSetGroupMemberInfoReq{
|
|
|
|
return webhook.WithCondition(ctx, before, func(ctx context.Context) error {
|
|
|
|
CallbackCommand: callbackstruct.CallbackBeforeSetGroupMemberInfoCommand,
|
|
|
|
cbReq := callbackstruct.CallbackBeforeSetGroupMemberInfoReq{
|
|
|
|
GroupID: req.GroupID,
|
|
|
|
CallbackCommand: callbackstruct.CallbackBeforeSetGroupMemberInfoCommand,
|
|
|
|
UserID: req.UserID,
|
|
|
|
GroupID: req.GroupID,
|
|
|
|
}
|
|
|
|
UserID: req.UserID,
|
|
|
|
if req.Nickname != nil {
|
|
|
|
}
|
|
|
|
cbReq.Nickname = &req.Nickname.Value
|
|
|
|
if req.Nickname != nil {
|
|
|
|
}
|
|
|
|
cbReq.Nickname = &req.Nickname.Value
|
|
|
|
if req.FaceURL != nil {
|
|
|
|
}
|
|
|
|
cbReq.FaceURL = &req.FaceURL.Value
|
|
|
|
if req.FaceURL != nil {
|
|
|
|
}
|
|
|
|
cbReq.FaceURL = &req.FaceURL.Value
|
|
|
|
if req.RoleLevel != nil {
|
|
|
|
}
|
|
|
|
cbReq.RoleLevel = &req.RoleLevel.Value
|
|
|
|
if req.RoleLevel != nil {
|
|
|
|
}
|
|
|
|
cbReq.RoleLevel = &req.RoleLevel.Value
|
|
|
|
if req.Ex != nil {
|
|
|
|
}
|
|
|
|
cbReq.Ex = &req.Ex.Value
|
|
|
|
if req.Ex != nil {
|
|
|
|
}
|
|
|
|
cbReq.Ex = &req.Ex.Value
|
|
|
|
resp := &callbackstruct.CallbackBeforeSetGroupMemberInfoResp{}
|
|
|
|
}
|
|
|
|
if err := s.webhookClient.SyncPost(ctx, cbReq.GetCallbackCommand(), cbReq, resp, before); err != nil {
|
|
|
|
resp := &callbackstruct.CallbackBeforeSetGroupMemberInfoResp{}
|
|
|
|
return err
|
|
|
|
if err := s.webhookClient.SyncPost(ctx, cbReq.GetCallbackCommand(), cbReq, resp, before); err != nil {
|
|
|
|
}
|
|
|
|
return err
|
|
|
|
if resp.FaceURL != nil {
|
|
|
|
}
|
|
|
|
req.FaceURL = wrapperspb.String(*resp.FaceURL)
|
|
|
|
if resp.FaceURL != nil {
|
|
|
|
}
|
|
|
|
req.FaceURL = wrapperspb.String(*resp.FaceURL)
|
|
|
|
if resp.Nickname != nil {
|
|
|
|
}
|
|
|
|
req.Nickname = wrapperspb.String(*resp.Nickname)
|
|
|
|
if resp.Nickname != nil {
|
|
|
|
}
|
|
|
|
req.Nickname = wrapperspb.String(*resp.Nickname)
|
|
|
|
if resp.RoleLevel != nil {
|
|
|
|
}
|
|
|
|
req.RoleLevel = wrapperspb.Int32(*resp.RoleLevel)
|
|
|
|
if resp.RoleLevel != nil {
|
|
|
|
}
|
|
|
|
req.RoleLevel = wrapperspb.Int32(*resp.RoleLevel)
|
|
|
|
if resp.Ex != nil {
|
|
|
|
}
|
|
|
|
req.Ex = wrapperspb.String(*resp.Ex)
|
|
|
|
if resp.Ex != nil {
|
|
|
|
}
|
|
|
|
req.Ex = wrapperspb.String(*resp.Ex)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (s *groupServer) webhookAfterSetGroupMemberInfo(ctx context.Context, after *config.AfterConfig, req *group.SetGroupMemberInfo) {
|
|
|
|
func (s *groupServer) webhookAfterSetGroupMemberInfo(ctx context.Context, after *config.AfterConfig, req *group.SetGroupMemberInfo) {
|
|
|
@ -202,12 +209,14 @@ func (s *groupServer) webhookAfterDismissGroup(ctx context.Context, after *confi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (s *groupServer) webhookBeforeApplyJoinGroup(ctx context.Context, before *config.BeforeConfig, req *callbackstruct.CallbackJoinGroupReq) (err error) {
|
|
|
|
func (s *groupServer) webhookBeforeApplyJoinGroup(ctx context.Context, before *config.BeforeConfig, req *callbackstruct.CallbackJoinGroupReq) (err error) {
|
|
|
|
req.CallbackCommand = callbackstruct.CallbackBeforeJoinGroupCommand
|
|
|
|
return webhook.WithCondition(ctx, before, func(ctx context.Context) error {
|
|
|
|
resp := &callbackstruct.CallbackJoinGroupResp{}
|
|
|
|
req.CallbackCommand = callbackstruct.CallbackBeforeJoinGroupCommand
|
|
|
|
if err := s.webhookClient.SyncPost(ctx, req.GetCallbackCommand(), req, resp, before); err != nil {
|
|
|
|
resp := &callbackstruct.CallbackJoinGroupResp{}
|
|
|
|
return err
|
|
|
|
if err := s.webhookClient.SyncPost(ctx, req.GetCallbackCommand(), req, resp, before); err != nil {
|
|
|
|
}
|
|
|
|
return err
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (s *groupServer) webhookAfterTransferGroupOwner(ctx context.Context, after *config.AfterConfig, req *group.TransferGroupOwnerReq) {
|
|
|
|
func (s *groupServer) webhookAfterTransferGroupOwner(ctx context.Context, after *config.AfterConfig, req *group.TransferGroupOwnerReq) {
|
|
|
@ -221,24 +230,26 @@ func (s *groupServer) webhookAfterTransferGroupOwner(ctx context.Context, after
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (s *groupServer) webhookBeforeInviteUserToGroup(ctx context.Context, before *config.BeforeConfig, req *group.InviteUserToGroupReq) (err error) {
|
|
|
|
func (s *groupServer) webhookBeforeInviteUserToGroup(ctx context.Context, before *config.BeforeConfig, req *group.InviteUserToGroupReq) (err error) {
|
|
|
|
cbReq := &callbackstruct.CallbackBeforeInviteUserToGroupReq{
|
|
|
|
return webhook.WithCondition(ctx, before, func(ctx context.Context) error {
|
|
|
|
CallbackCommand: callbackstruct.CallbackBeforeInviteJoinGroupCommand,
|
|
|
|
cbReq := &callbackstruct.CallbackBeforeInviteUserToGroupReq{
|
|
|
|
OperationID: mcontext.GetOperationID(ctx),
|
|
|
|
CallbackCommand: callbackstruct.CallbackBeforeInviteJoinGroupCommand,
|
|
|
|
GroupID: req.GroupID,
|
|
|
|
OperationID: mcontext.GetOperationID(ctx),
|
|
|
|
Reason: req.Reason,
|
|
|
|
GroupID: req.GroupID,
|
|
|
|
InvitedUserIDs: req.InvitedUserIDs,
|
|
|
|
Reason: req.Reason,
|
|
|
|
}
|
|
|
|
InvitedUserIDs: req.InvitedUserIDs,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp := &callbackstruct.CallbackBeforeInviteUserToGroupResp{}
|
|
|
|
resp := &callbackstruct.CallbackBeforeInviteUserToGroupResp{}
|
|
|
|
if err := s.webhookClient.SyncPost(ctx, cbReq.GetCallbackCommand(), cbReq, resp, before); err != nil {
|
|
|
|
if err := s.webhookClient.SyncPost(ctx, cbReq.GetCallbackCommand(), cbReq, resp, before); err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if len(resp.RefusedMembersAccount) > 0 {
|
|
|
|
if len(resp.RefusedMembersAccount) > 0 {
|
|
|
|
// Handle the scenario where certain members are refused
|
|
|
|
// Handle the scenario where certain members are refused
|
|
|
|
// You might want to update the req.Members list or handle it as per your business logic
|
|
|
|
// You might want to update the req.Members list or handle it as per your business logic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (s *groupServer) webhookAfterJoinGroup(ctx context.Context, after *config.AfterConfig, req *group.JoinGroupReq) {
|
|
|
|
func (s *groupServer) webhookAfterJoinGroup(ctx context.Context, after *config.AfterConfig, req *group.JoinGroupReq) {
|
|
|
@ -254,51 +265,52 @@ func (s *groupServer) webhookAfterJoinGroup(ctx context.Context, after *config.A
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (s *groupServer) webhookBeforeSetGroupInfo(ctx context.Context, before *config.BeforeConfig, req *group.SetGroupInfoReq) error {
|
|
|
|
func (s *groupServer) webhookBeforeSetGroupInfo(ctx context.Context, before *config.BeforeConfig, req *group.SetGroupInfoReq) error {
|
|
|
|
|
|
|
|
return webhook.WithCondition(ctx, before, func(ctx context.Context) error {
|
|
|
|
|
|
|
|
cbReq := &callbackstruct.CallbackBeforeSetGroupInfoReq{
|
|
|
|
|
|
|
|
CallbackCommand: callbackstruct.CallbackBeforeSetGroupInfoCommand,
|
|
|
|
|
|
|
|
GroupID: req.GroupInfoForSet.GroupID,
|
|
|
|
|
|
|
|
Notification: req.GroupInfoForSet.Notification,
|
|
|
|
|
|
|
|
Introduction: req.GroupInfoForSet.Introduction,
|
|
|
|
|
|
|
|
FaceURL: req.GroupInfoForSet.FaceURL,
|
|
|
|
|
|
|
|
GroupName: req.GroupInfoForSet.GroupName,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if req.GroupInfoForSet.Ex != nil {
|
|
|
|
|
|
|
|
cbReq.Ex = req.GroupInfoForSet.Ex.Value
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
log.ZDebug(ctx, "debug CallbackBeforeSetGroupInfo", "ex", cbReq.Ex)
|
|
|
|
|
|
|
|
if req.GroupInfoForSet.NeedVerification != nil {
|
|
|
|
|
|
|
|
cbReq.NeedVerification = req.GroupInfoForSet.NeedVerification.Value
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if req.GroupInfoForSet.LookMemberInfo != nil {
|
|
|
|
|
|
|
|
cbReq.LookMemberInfo = req.GroupInfoForSet.LookMemberInfo.Value
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if req.GroupInfoForSet.ApplyMemberFriend != nil {
|
|
|
|
|
|
|
|
cbReq.ApplyMemberFriend = req.GroupInfoForSet.ApplyMemberFriend.Value
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
resp := &callbackstruct.CallbackBeforeSetGroupInfoResp{}
|
|
|
|
|
|
|
|
|
|
|
|
cbReq := &callbackstruct.CallbackBeforeSetGroupInfoReq{
|
|
|
|
if err := s.webhookClient.SyncPost(ctx, cbReq.GetCallbackCommand(), cbReq, resp, before); err != nil {
|
|
|
|
CallbackCommand: callbackstruct.CallbackBeforeSetGroupInfoCommand,
|
|
|
|
return err
|
|
|
|
GroupID: req.GroupInfoForSet.GroupID,
|
|
|
|
}
|
|
|
|
Notification: req.GroupInfoForSet.Notification,
|
|
|
|
|
|
|
|
Introduction: req.GroupInfoForSet.Introduction,
|
|
|
|
|
|
|
|
FaceURL: req.GroupInfoForSet.FaceURL,
|
|
|
|
|
|
|
|
GroupName: req.GroupInfoForSet.GroupName,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if req.GroupInfoForSet.Ex != nil {
|
|
|
|
|
|
|
|
cbReq.Ex = req.GroupInfoForSet.Ex.Value
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
log.ZDebug(ctx, "debug CallbackBeforeSetGroupInfo", cbReq.Ex)
|
|
|
|
|
|
|
|
if req.GroupInfoForSet.NeedVerification != nil {
|
|
|
|
|
|
|
|
cbReq.NeedVerification = req.GroupInfoForSet.NeedVerification.Value
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if req.GroupInfoForSet.LookMemberInfo != nil {
|
|
|
|
|
|
|
|
cbReq.LookMemberInfo = req.GroupInfoForSet.LookMemberInfo.Value
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if req.GroupInfoForSet.ApplyMemberFriend != nil {
|
|
|
|
|
|
|
|
cbReq.ApplyMemberFriend = req.GroupInfoForSet.ApplyMemberFriend.Value
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
resp := &callbackstruct.CallbackBeforeSetGroupInfoResp{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err := s.webhookClient.SyncPost(ctx, cbReq.GetCallbackCommand(), cbReq, resp, before); err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if resp.Ex != nil {
|
|
|
|
if resp.Ex != nil {
|
|
|
|
req.GroupInfoForSet.Ex = wrapperspb.String(*resp.Ex)
|
|
|
|
req.GroupInfoForSet.Ex = wrapperspb.String(*resp.Ex)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if resp.NeedVerification != nil {
|
|
|
|
if resp.NeedVerification != nil {
|
|
|
|
req.GroupInfoForSet.NeedVerification = wrapperspb.Int32(*resp.NeedVerification)
|
|
|
|
req.GroupInfoForSet.NeedVerification = wrapperspb.Int32(*resp.NeedVerification)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if resp.LookMemberInfo != nil {
|
|
|
|
if resp.LookMemberInfo != nil {
|
|
|
|
req.GroupInfoForSet.LookMemberInfo = wrapperspb.Int32(*resp.LookMemberInfo)
|
|
|
|
req.GroupInfoForSet.LookMemberInfo = wrapperspb.Int32(*resp.LookMemberInfo)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if resp.ApplyMemberFriend != nil {
|
|
|
|
if resp.ApplyMemberFriend != nil {
|
|
|
|
req.GroupInfoForSet.ApplyMemberFriend = wrapperspb.Int32(*resp.ApplyMemberFriend)
|
|
|
|
req.GroupInfoForSet.ApplyMemberFriend = wrapperspb.Int32(*resp.ApplyMemberFriend)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
datautil.NotNilReplace(&req.GroupInfoForSet.GroupID, &resp.GroupID)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfoForSet.GroupID, &resp.GroupID)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfoForSet.GroupName, &resp.GroupName)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfoForSet.GroupName, &resp.GroupName)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfoForSet.FaceURL, &resp.FaceURL)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfoForSet.FaceURL, &resp.FaceURL)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfoForSet.Introduction, &resp.Introduction)
|
|
|
|
datautil.NotNilReplace(&req.GroupInfoForSet.Introduction, &resp.Introduction)
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (s *groupServer) webhookAfterSetGroupInfo(ctx context.Context, after *config.AfterConfig, req *group.SetGroupInfoReq) {
|
|
|
|
func (s *groupServer) webhookAfterSetGroupInfo(ctx context.Context, after *config.AfterConfig, req *group.SetGroupInfoReq) {
|
|
|
|