feat: add im kafka admin integration

This commit is contained in:
richjohnrambo
2026-09-04 11:57:38 +08:00
parent a2abaef3a6
commit f7f8cc0ef0
74 changed files with 6254 additions and 47 deletions
@@ -2,8 +2,10 @@ package sys
import (
"context"
"hotgo/internal/consts"
"hotgo/internal/dao"
"hotgo/internal/library/contexts"
"hotgo/internal/library/imkafka"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
@@ -11,6 +13,7 @@ import (
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/util/gconv"
)
const (
@@ -62,6 +65,24 @@ func (s *sSysImRegistration) UpdateConfig(ctx context.Context, in *sysin.ImRegis
"old": old.RegisterSmsEnabled,
"new": in.RegisterSmsEnabled,
})
actorName := ""
if user := contexts.GetUser(ctx); user != nil {
actorName = user.RealName
}
if eventErr := imkafka.PublishConfigEvent(ctx, imkafka.ConfigEventInput{
EventType: consts.ImConfigEventRegistrationUpdated,
BizID: "registration",
Group: imRegistrationConfigGroup,
Keys: []string{imRegistrationSmsKey},
Actor: &imkafka.Actor{
Type: "admin",
ID: gconv.String(contexts.GetUserId(ctx)),
DisplayName: actorName,
},
CreatedBy: contexts.GetUserId(ctx),
}); eventErr != nil {
g.Log().Warningf(ctx, "发送IM注册配置Kafka事件失败 err:%+v", eventErr)
}
return
}