feat: add superadmin assets and notifications
This commit is contained in:
119
backend/app/http/super/v1/dto/super_asset.go
Normal file
119
backend/app/http/super/v1/dto/super_asset.go
Normal 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"`
|
||||
}
|
||||
140
backend/app/http/super/v1/dto/super_notification.go
Normal file
140
backend/app/http/super/v1/dto/super_notification.go
Normal 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"`
|
||||
}
|
||||
Reference in New Issue
Block a user