feat: add im kafka admin integration
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
// Package sysin
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2026 HotGo
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sysin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/internal/model/input/form"
|
||||
"strings"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type ImKafkaCommandListInp struct {
|
||||
form.PageReq
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
CommandId string `json:"commandId" dc:"命令ID"`
|
||||
EventId string `json:"eventId" dc:"事件ID"`
|
||||
EventType string `json:"eventType" dc:"事件类型"`
|
||||
BizType string `json:"bizType" dc:"业务类型"`
|
||||
BizId string `json:"bizId" dc:"业务ID"`
|
||||
Status string `json:"status" dc:"状态"`
|
||||
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
}
|
||||
|
||||
func (in *ImKafkaCommandListInp) Filter(ctx context.Context) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
type ImKafkaCommandListModel struct {
|
||||
Id int64 `json:"id" dc:"ID"`
|
||||
CommandId string `json:"commandId" dc:"命令ID"`
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
TenantCode string `json:"tenantCode" dc:"租户编码"`
|
||||
EventId string `json:"eventId" dc:"事件ID"`
|
||||
EventType string `json:"eventType" dc:"事件类型"`
|
||||
BizType string `json:"bizType" dc:"业务类型"`
|
||||
BizId string `json:"bizId" dc:"业务ID"`
|
||||
IdempotencyKey string `json:"idempotencyKey" dc:"幂等键"`
|
||||
Status string `json:"status" dc:"状态"`
|
||||
Reason string `json:"reason" dc:"错误码"`
|
||||
Message string `json:"message" dc:"消息"`
|
||||
SentAt *gtime.Time `json:"sentAt" dc:"投递时间"`
|
||||
CompletedAt *gtime.Time `json:"completedAt" dc:"完成时间"`
|
||||
CreatedBy int64 `json:"createdBy" dc:"创建人"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
|
||||
}
|
||||
|
||||
type ImKafkaCommandViewInp struct {
|
||||
Id int64 `json:"id" dc:"ID"`
|
||||
CommandId string `json:"commandId" dc:"命令ID"`
|
||||
}
|
||||
|
||||
func (in *ImKafkaCommandViewInp) Filter(ctx context.Context) (err error) {
|
||||
if in.Id <= 0 && in.CommandId == "" {
|
||||
return gerror.New("请选择IM后台命令")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ImKafkaCommandViewModel struct {
|
||||
ImKafkaCommandListModel
|
||||
Payload string `json:"payload" dc:"Payload"`
|
||||
Envelope string `json:"envelope" dc:"Envelope"`
|
||||
Result string `json:"result" dc:"Result"`
|
||||
}
|
||||
|
||||
type ImKafkaCacheInvalidateInp struct {
|
||||
TenantCode string `json:"tenantCode" dc:"租户编码"`
|
||||
Namespace string `json:"namespace" dc:"缓存命名空间"`
|
||||
Keys []string `json:"keys" dc:"缓存Key"`
|
||||
Reason string `json:"reason" dc:"原因"`
|
||||
}
|
||||
|
||||
func (in *ImKafkaCacheInvalidateInp) Filter(ctx context.Context) (err error) {
|
||||
in.TenantCode = strings.TrimSpace(in.TenantCode)
|
||||
in.Namespace = strings.TrimSpace(in.Namespace)
|
||||
if in.TenantCode == "" {
|
||||
return gerror.New("请选择租户")
|
||||
}
|
||||
if in.Namespace == "" {
|
||||
return gerror.New("请输入缓存命名空间")
|
||||
}
|
||||
keys := make([]string, 0, len(in.Keys))
|
||||
for _, key := range in.Keys {
|
||||
if key = strings.TrimSpace(key); key != "" {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
}
|
||||
in.Keys = keys
|
||||
return nil
|
||||
}
|
||||
|
||||
type ImKafkaEventModel struct {
|
||||
EventId string `json:"eventId" dc:"Kafka事件ID"`
|
||||
}
|
||||
|
||||
type ImKafkaWorkbenchEventInp struct {
|
||||
TenantCode string `json:"tenantCode" dc:"租户编码"`
|
||||
EventType string `json:"eventType" dc:"事件类型"`
|
||||
BizId string `json:"bizId" dc:"业务ID"`
|
||||
Payload map[string]any `json:"payload" dc:"Payload"`
|
||||
}
|
||||
|
||||
func (in *ImKafkaWorkbenchEventInp) Filter(ctx context.Context) (err error) {
|
||||
in.TenantCode = strings.TrimSpace(in.TenantCode)
|
||||
in.EventType = strings.TrimSpace(in.EventType)
|
||||
in.BizId = strings.TrimSpace(in.BizId)
|
||||
if in.TenantCode == "" {
|
||||
return gerror.New("请选择租户")
|
||||
}
|
||||
if in.EventType == "" {
|
||||
in.EventType = "workbench.connectivity.test"
|
||||
}
|
||||
if in.BizId == "" {
|
||||
in.BizId = "admin_connectivity_test"
|
||||
}
|
||||
if in.Payload == nil {
|
||||
in.Payload = map[string]any{}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user