feat: add IM admin P1 operations
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
package sysin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/internal/model/input/form"
|
||||
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type ImExternalConfigListInp struct {
|
||||
form.PageReq
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Service string `json:"service" dc:"服务"`
|
||||
Provider string `json:"provider" dc:"服务商"`
|
||||
Enabled *int `json:"enabled" dc:"是否启用"`
|
||||
}
|
||||
|
||||
func (in *ImExternalConfigListInp) Filter(ctx context.Context) (err error) { return }
|
||||
|
||||
type ImExternalConfigListModel struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
TenantName string `json:"tenantName" dc:"租户名称"`
|
||||
Id int64 `json:"id" dc:"ID"`
|
||||
Service string `json:"service" dc:"服务"`
|
||||
Provider string `json:"provider" dc:"服务商"`
|
||||
Endpoint string `json:"endpoint" dc:"端点"`
|
||||
Enabled int `json:"enabled" dc:"是否启用"`
|
||||
Status string `json:"status" dc:"配置状态"`
|
||||
ConfigJson string `json:"configJson" dc:"普通配置"`
|
||||
HasSecret bool `json:"hasSecret" dc:"是否有敏感配置"`
|
||||
CheckedAt *gtime.Time `json:"checkedAt" dc:"检查时间"`
|
||||
CheckResult string `json:"checkResult" dc:"检查结果"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
|
||||
}
|
||||
|
||||
type ImExternalConfigViewInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Service string `json:"service" v:"required#服务不能为空" dc:"服务"`
|
||||
}
|
||||
|
||||
func (in *ImExternalConfigViewInp) Filter(ctx context.Context) (err error) {
|
||||
if in.Service == "" {
|
||||
return gerror.New("服务不能为空")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type ImExternalConfigViewModel struct {
|
||||
ImExternalConfigListModel
|
||||
}
|
||||
|
||||
type ImExternalConfigUpdateInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Service string `json:"service" v:"required#服务不能为空" dc:"服务"`
|
||||
Provider string `json:"provider" dc:"服务商"`
|
||||
Endpoint string `json:"endpoint" dc:"端点"`
|
||||
Enabled int `json:"enabled" dc:"是否启用"`
|
||||
ConfigJson *gjson.Json `json:"configJson" dc:"普通配置"`
|
||||
SecretJson *gjson.Json `json:"secretJson" dc:"敏感配置,空则保持原值"`
|
||||
}
|
||||
|
||||
func (in *ImExternalConfigUpdateInp) Filter(ctx context.Context) (err error) {
|
||||
if in.Service == "" {
|
||||
return gerror.New("服务不能为空")
|
||||
}
|
||||
if in.Enabled != 0 && in.Enabled != 1 {
|
||||
return gerror.New("启用状态不正确")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type ImExternalConfigCheckInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Service string `json:"service" v:"required#服务不能为空" dc:"服务"`
|
||||
}
|
||||
|
||||
func (in *ImExternalConfigCheckInp) Filter(ctx context.Context) (err error) {
|
||||
if in.Service == "" {
|
||||
return gerror.New("服务不能为空")
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
// 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"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type ImFileListInp struct {
|
||||
form.PageReq
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
FileId int64 `json:"fileId" dc:"文件ID"`
|
||||
UserId int64 `json:"userId" dc:"上传用户ID"`
|
||||
Status *int `json:"status" dc:"状态"`
|
||||
Purpose string `json:"purpose" dc:"用途"`
|
||||
MimeType string `json:"mimeType" dc:"MIME类型"`
|
||||
Topic string `json:"topic" dc:"关联Topic"`
|
||||
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
UpdatedAt []*gtime.Time `json:"updatedAt" dc:"更新时间"`
|
||||
}
|
||||
|
||||
func (in *ImFileListInp) Filter(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type ImFileListModel struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
TenantName string `json:"tenantName" dc:"租户名称"`
|
||||
Id int64 `json:"id" dc:"文件ID"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
|
||||
UserId int64 `json:"userId" dc:"上传用户ID"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
MimeType string `json:"mimeType" dc:"MIME类型"`
|
||||
Size int64 `json:"size" dc:"大小"`
|
||||
Etag string `json:"etag" dc:"ETag"`
|
||||
Location string `json:"location" dc:"文件位置"`
|
||||
Purpose string `json:"purpose" dc:"用途"`
|
||||
LinkCount int `json:"linkCount" dc:"引用数"`
|
||||
FirstTopic string `json:"firstTopic" dc:"首个关联Topic"`
|
||||
FirstMsgId int64 `json:"firstMsgId" dc:"首个关联消息ID"`
|
||||
FirstLinkAt *gtime.Time `json:"firstLinkAt" dc:"首个关联时间"`
|
||||
}
|
||||
|
||||
type ImFileViewInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Id int64 `json:"id" v:"required#文件ID不能为空" dc:"文件ID"`
|
||||
}
|
||||
|
||||
func (in *ImFileViewInp) Filter(ctx context.Context) (err error) {
|
||||
if in.Id <= 0 {
|
||||
return gerror.New("文件ID不能为空")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type ImFileViewModel struct {
|
||||
ImFileListModel
|
||||
Links []*ImFileLinkModel `json:"links" dc:"引用列表"`
|
||||
}
|
||||
|
||||
type ImFileLinkModel struct {
|
||||
Id int64 `json:"id" dc:"ID"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
FileId int64 `json:"fileId" dc:"文件ID"`
|
||||
MsgId int64 `json:"msgId" dc:"消息ID"`
|
||||
Topic string `json:"topic" dc:"Topic"`
|
||||
UserId int64 `json:"userId" dc:"用户ID"`
|
||||
}
|
||||
|
||||
type ImFileActionInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Id int64 `json:"id" v:"required#文件ID不能为空" dc:"文件ID"`
|
||||
Reason string `json:"reason" dc:"原因"`
|
||||
}
|
||||
|
||||
func (in *ImFileActionInp) Filter(ctx context.Context) (err error) {
|
||||
if in.Id <= 0 {
|
||||
return gerror.New("文件ID不能为空")
|
||||
}
|
||||
if len([]rune(in.Reason)) > 200 {
|
||||
return gerror.New("原因不能超过200个字符")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type ImFileCleanupOrphanInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Days int `json:"days" dc:"保留天数"`
|
||||
Limit int `json:"limit" dc:"处理上限"`
|
||||
}
|
||||
|
||||
func (in *ImFileCleanupOrphanInp) Filter(ctx context.Context) (err error) {
|
||||
if in.Days <= 0 {
|
||||
in.Days = 7
|
||||
}
|
||||
if in.Limit <= 0 {
|
||||
in.Limit = 100
|
||||
}
|
||||
if in.Limit > 1000 {
|
||||
return gerror.New("单次清理上限不能超过1000")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type ImFileCleanupOrphanModel struct {
|
||||
Count int `json:"count" dc:"标记数量"`
|
||||
Locations []string `json:"locations" dc:"待物理清理位置"`
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package sysin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/internal/model/input/form"
|
||||
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type ImTaskDashboardListInp struct {
|
||||
form.PageReq
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Status string `json:"status" dc:"状态"`
|
||||
}
|
||||
|
||||
func (in *ImTaskDashboardListInp) Filter(ctx context.Context) (err error) { return }
|
||||
|
||||
type ImTaskDashboardListModel struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
TenantName string `json:"tenantName" dc:"租户名称"`
|
||||
TenantCode string `json:"tenantCode" dc:"租户编码"`
|
||||
TenantState int `json:"tenantState" dc:"租户状态"`
|
||||
DbStatus string `json:"dbStatus" dc:"数据库状态"`
|
||||
Status string `json:"status" dc:"看板状态"`
|
||||
OutboxPendingCount int `json:"outboxPendingCount" dc:"业务Outbox待处理"`
|
||||
OutboxFailedCount int `json:"outboxFailedCount" dc:"业务Outbox失败"`
|
||||
GroupOutboxPending int `json:"groupOutboxPending" dc:"群Outbox待处理"`
|
||||
GroupOutboxFailed int `json:"groupOutboxFailed" dc:"群Outbox失败"`
|
||||
OrphanFileCount int `json:"orphanFileCount" dc:"孤儿文件数"`
|
||||
DeletedFileCount int `json:"deletedFileCount" dc:"待物理清理文件数"`
|
||||
LastOutboxCreatedAt *gtime.Time `json:"lastOutboxCreatedAt" dc:"最新Outbox时间"`
|
||||
LastGroupEventAt *gtime.Time `json:"lastGroupEventAt" dc:"最新群事件时间"`
|
||||
LastFileUpdatedAt *gtime.Time `json:"lastFileUpdatedAt" dc:"最新文件更新时间"`
|
||||
RecommendedNextAction string `json:"recommendedNextAction" dc:"建议动作"`
|
||||
}
|
||||
Reference in New Issue
Block a user