feat: add superadmin assets and notifications

This commit is contained in:
2026-01-15 15:28:41 +08:00
parent c683fa5cf3
commit b896d0fa00
22 changed files with 4852 additions and 260 deletions

View File

@@ -0,0 +1,119 @@
package dto
import (
"quyun/v2/app/requests"
"quyun/v2/pkg/consts"
)
// SuperAssetListFilter 超管资产列表查询条件。
type SuperAssetListFilter struct {
requests.Pagination
// ID 资产ID精确匹配。
ID *int64 `query:"id"`
// TenantID 租户ID精确匹配。
TenantID *int64 `query:"tenant_id"`
// TenantCode 租户编码,模糊匹配。
TenantCode *string `query:"tenant_code"`
// TenantName 租户名称,模糊匹配。
TenantName *string `query:"tenant_name"`
// UserID 上传用户ID精确匹配。
UserID *int64 `query:"user_id"`
// Username 上传用户名/昵称,模糊匹配。
Username *string `query:"username"`
// Type 媒体类型过滤。
Type *consts.MediaAssetType `query:"type"`
// Status 处理状态过滤。
Status *consts.MediaAssetStatus `query:"status"`
// Provider 存储提供方过滤。
Provider *string `query:"provider"`
// ObjectKey 对象Key关键字模糊匹配。
ObjectKey *string `query:"object_key"`
// CreatedAtFrom 上传时间起始RFC3339
CreatedAtFrom *string `query:"created_at_from"`
// CreatedAtTo 上传时间结束RFC3339
CreatedAtTo *string `query:"created_at_to"`
// SizeMin 文件大小下限(字节)。
SizeMin *int64 `query:"size_min"`
// SizeMax 文件大小上限(字节)。
SizeMax *int64 `query:"size_max"`
// Asc 升序字段id/created_at
Asc *string `query:"asc"`
// Desc 降序字段id/created_at
Desc *string `query:"desc"`
}
// SuperAssetUsageFilter 超管资产用量统计查询条件。
type SuperAssetUsageFilter struct {
// TenantID 租户ID不传代表全平台
TenantID *int64 `query:"tenant_id"`
}
// SuperAssetDeleteQuery 超管资产删除参数。
type SuperAssetDeleteQuery struct {
// Force 是否强制删除(忽略被内容引用的限制)。
Force *bool `query:"force"`
}
// SuperAssetItem 超管资产条目。
type SuperAssetItem struct {
// ID 资产ID。
ID int64 `json:"id"`
// TenantID 租户ID。
TenantID int64 `json:"tenant_id"`
// TenantCode 租户编码。
TenantCode string `json:"tenant_code"`
// TenantName 租户名称。
TenantName string `json:"tenant_name"`
// UserID 上传用户ID。
UserID int64 `json:"user_id"`
// Username 上传用户名/昵称。
Username string `json:"username"`
// Type 媒体类型。
Type consts.MediaAssetType `json:"type"`
// Status 处理状态。
Status consts.MediaAssetStatus `json:"status"`
// Provider 存储提供方。
Provider string `json:"provider"`
// Bucket 存储桶名称。
Bucket string `json:"bucket"`
// ObjectKey 对象Key。
ObjectKey string `json:"object_key"`
// URL 访问URL若可用
URL string `json:"url"`
// Filename 原始文件名。
Filename string `json:"filename"`
// Size 文件大小(字节)。
Size int64 `json:"size"`
// Hash 文件哈希MD5
Hash string `json:"hash"`
// Variant 媒体变体main/preview/cover 等)。
Variant consts.MediaAssetVariant `json:"variant"`
// SourceAssetID 源资产ID用于变体关联
SourceAssetID int64 `json:"source_asset_id"`
// UsedCount 被内容引用次数。
UsedCount int64 `json:"used_count"`
// CreatedAt 创建时间RFC3339
CreatedAt string `json:"created_at"`
// UpdatedAt 更新时间RFC3339
UpdatedAt string `json:"updated_at"`
}
// SuperAssetUsageResponse 超管资产用量统计响应。
type SuperAssetUsageResponse struct {
// TotalCount 资产总量。
TotalCount int64 `json:"total_count"`
// TotalSize 资产总大小(字节)。
TotalSize int64 `json:"total_size"`
// ByType 按媒体类型汇总的用量统计。
ByType []SuperAssetUsageItem `json:"by_type"`
}
// SuperAssetUsageItem 资产类型用量统计条目。
type SuperAssetUsageItem struct {
// Type 媒体类型。
Type consts.MediaAssetType `json:"type"`
// Count 该类型资产数量。
Count int64 `json:"count"`
// TotalSize 该类型资产大小总和(字节)。
TotalSize int64 `json:"total_size"`
}

View File

@@ -0,0 +1,140 @@
package dto
import (
"quyun/v2/app/requests"
"quyun/v2/pkg/consts"
)
// SuperNotificationListFilter 超管通知列表查询条件。
type SuperNotificationListFilter struct {
requests.Pagination
// ID 通知ID精确匹配。
ID *int64 `query:"id"`
// TenantID 租户ID精确匹配。
TenantID *int64 `query:"tenant_id"`
// TenantCode 租户编码,模糊匹配。
TenantCode *string `query:"tenant_code"`
// TenantName 租户名称,模糊匹配。
TenantName *string `query:"tenant_name"`
// UserID 用户ID精确匹配。
UserID *int64 `query:"user_id"`
// Username 用户名/昵称,模糊匹配。
Username *string `query:"username"`
// Type 通知类型过滤。
Type *consts.NotificationType `query:"type"`
// IsRead 是否已读过滤。
IsRead *bool `query:"is_read"`
// Keyword 标题或内容关键词,模糊匹配。
Keyword *string `query:"keyword"`
// CreatedAtFrom 创建时间起始RFC3339
CreatedAtFrom *string `query:"created_at_from"`
// CreatedAtTo 创建时间结束RFC3339
CreatedAtTo *string `query:"created_at_to"`
// Asc 升序字段id/created_at
Asc *string `query:"asc"`
// Desc 降序字段id/created_at
Desc *string `query:"desc"`
}
// SuperNotificationBroadcastForm 超管通知群发参数。
type SuperNotificationBroadcastForm struct {
// TenantID 租户ID选填用于指定租户成员
TenantID *int64 `json:"tenant_id"`
// UserIDs 指定接收用户ID列表优先级高于 TenantID
UserIDs []int64 `json:"user_ids"`
// Type 通知类型system/order/audit/interaction
Type consts.NotificationType `json:"type"`
// Title 通知标题。
Title string `json:"title"`
// Content 通知内容。
Content string `json:"content"`
}
// SuperNotificationItem 超管通知条目。
type SuperNotificationItem struct {
// ID 通知ID。
ID int64 `json:"id"`
// TenantID 租户ID。
TenantID int64 `json:"tenant_id"`
// TenantCode 租户编码。
TenantCode string `json:"tenant_code"`
// TenantName 租户名称。
TenantName string `json:"tenant_name"`
// UserID 用户ID。
UserID int64 `json:"user_id"`
// Username 用户名/昵称。
Username string `json:"username"`
// Type 通知类型。
Type consts.NotificationType `json:"type"`
// Title 通知标题。
Title string `json:"title"`
// Content 通知内容。
Content string `json:"content"`
// IsRead 是否已读。
IsRead bool `json:"is_read"`
// CreatedAt 创建时间RFC3339
CreatedAt string `json:"created_at"`
}
// SuperNotificationTemplateListFilter 超管通知模板列表查询条件。
type SuperNotificationTemplateListFilter struct {
requests.Pagination
// TenantID 租户ID不传代表全平台模板
TenantID *int64 `query:"tenant_id"`
// Keyword 模板名称或标题关键字,模糊匹配。
Keyword *string `query:"keyword"`
// Type 通知类型过滤。
Type *consts.NotificationType `query:"type"`
// IsActive 是否启用过滤。
IsActive *bool `query:"is_active"`
// CreatedAtFrom 创建时间起始RFC3339
CreatedAtFrom *string `query:"created_at_from"`
// CreatedAtTo 创建时间结束RFC3339
CreatedAtTo *string `query:"created_at_to"`
// Asc 升序字段id/created_at
Asc *string `query:"asc"`
// Desc 降序字段id/created_at
Desc *string `query:"desc"`
}
// SuperNotificationTemplateCreateForm 超管通知模板创建参数。
type SuperNotificationTemplateCreateForm struct {
// TenantID 租户ID不传代表全平台模板
TenantID *int64 `json:"tenant_id"`
// Name 模板名称(用于识别用途)。
Name string `json:"name"`
// Type 通知类型system/order/audit/interaction
Type consts.NotificationType `json:"type"`
// Title 通知标题。
Title string `json:"title"`
// Content 通知内容。
Content string `json:"content"`
// IsActive 是否启用(不传默认启用)。
IsActive *bool `json:"is_active"`
}
// SuperNotificationTemplateItem 超管通知模板条目。
type SuperNotificationTemplateItem struct {
// ID 模板ID。
ID int64 `json:"id"`
// TenantID 租户ID。
TenantID int64 `json:"tenant_id"`
// TenantCode 租户编码。
TenantCode string `json:"tenant_code"`
// TenantName 租户名称。
TenantName string `json:"tenant_name"`
// Name 模板名称。
Name string `json:"name"`
// Type 通知类型。
Type consts.NotificationType `json:"type"`
// Title 模板标题。
Title string `json:"title"`
// Content 模板内容。
Content string `json:"content"`
// IsActive 是否启用。
IsActive bool `json:"is_active"`
// CreatedAt 创建时间RFC3339
CreatedAt string `json:"created_at"`
// UpdatedAt 更新时间RFC3339
UpdatedAt string `json:"updated_at"`
}