Files
im_manager/server/internal/model/input/sysin/im_dead_letter.go
T

131 lines
4.4 KiB
Go

// 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"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
)
type ImDeadLetterListInp struct {
TenantId int64 `json:"tenantId" dc:"租户ID"`
Status string `json:"status" dc:"状态"`
BizType string `json:"bizType" dc:"业务类型"`
BizId string `json:"bizId" dc:"业务ID"`
EventType string `json:"eventType" dc:"事件类型"`
Cursor string `json:"cursor" dc:"游标"`
Limit int `json:"limit" dc:"数量"`
}
func (in *ImDeadLetterListInp) Filter(ctx context.Context) (err error) {
if in.TenantId <= 0 {
return gerror.New("请选择IM租户")
}
if in.Limit <= 0 || in.Limit > 200 {
in.Limit = 50
}
return nil
}
type ImDeadLetterListModel struct {
Id int64 `json:"id" dc:"ID"`
DeadId string `json:"deadId" dc:"死信ID"`
EventId string `json:"eventId" dc:"事件ID"`
ParentEventId string `json:"parentEventId" dc:"父事件ID"`
SourceTopic string `json:"sourceTopic" dc:"来源Topic"`
ConsumerGroup string `json:"consumerGroup" dc:"消费组"`
EventType string `json:"eventType" dc:"事件类型"`
BizType string `json:"bizType" dc:"业务类型"`
BizId string `json:"bizId" dc:"业务ID"`
RetryCount int `json:"retryCount" dc:"重试次数"`
LastReason string `json:"lastReason" dc:"最后原因"`
LastError string `json:"lastError" dc:"最后错误"`
Status string `json:"status" dc:"状态"`
ReplayCount int `json:"replayCount" dc:"重放次数"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
type ImDeadLetterListModelRaw struct {
Id int64 `json:"id"`
DeadId string `json:"dead_id"`
EventId string `json:"event_id"`
ParentEventId string `json:"parent_event_id"`
SourceTopic string `json:"source_topic"`
ConsumerGroup string `json:"consumer_group"`
EventType string `json:"event_type"`
BizType string `json:"biz_type"`
BizId string `json:"biz_id"`
RetryCount int `json:"retry_count"`
LastReason string `json:"last_reason"`
LastError string `json:"last_error"`
Status string `json:"status"`
ReplayCount int `json:"replay_count"`
CreatedAt *gtime.Time `json:"created_at"`
UpdatedAt *gtime.Time `json:"updated_at"`
}
type ImDeadLetterPageModel struct {
List []*ImDeadLetterListModel `json:"list" dc:"数据列表"`
NextCursor string `json:"nextCursor" dc:"下一页游标"`
HasMore bool `json:"hasMore" dc:"是否还有更多"`
}
type ImDeadLetterPageRaw struct {
Items []*ImDeadLetterListModelRaw `json:"items"`
NextCursor string `json:"next_cursor"`
HasMore bool `json:"has_more"`
}
type ImDeadLetterViewInp struct {
TenantId int64 `json:"tenantId" dc:"租户ID"`
DeadId string `json:"deadId" dc:"死信ID"`
}
func (in *ImDeadLetterViewInp) Filter(ctx context.Context) (err error) {
if in.TenantId <= 0 {
return gerror.New("请选择IM租户")
}
if in.DeadId == "" {
return gerror.New("请选择Kafka死信")
}
return nil
}
type ImDeadLetterViewModel struct {
ImDeadLetterListModel
Envelope string `json:"envelope" dc:"Envelope"`
EnvelopeRaw string `json:"envelopeRaw" dc:"Envelope Raw"`
}
type ImDeadLetterViewRaw struct {
ImDeadLetterListModelRaw
Envelope any `json:"envelope"`
EnvelopeRaw string `json:"envelope_raw"`
}
type ImDeadLetterActionInp struct {
TenantId int64 `json:"tenantId" dc:"租户ID"`
DeadId string `json:"deadId" dc:"死信ID"`
ActorUserId int64 `json:"actorUserId" dc:"操作IM用户ID"`
Note string `json:"note" dc:"备注"`
}
func (in *ImDeadLetterActionInp) Filter(ctx context.Context) (err error) {
if in.TenantId <= 0 {
return gerror.New("请选择IM租户")
}
if in.DeadId == "" {
return gerror.New("请选择Kafka死信")
}
if in.ActorUserId <= 0 {
return gerror.New("操作IM用户ID不能为空")
}
return nil
}