169 lines
9.7 KiB
Go
169 lines
9.7 KiB
Go
package dto
|
||
|
||
// ========== 资产相关请求 ==========
|
||
|
||
// CreateMintOrderRequestDTO 创建铸造订单请求
|
||
type CreateMintOrderRequestDTO struct {
|
||
OrderID string `json:"order_id" binding:"required"` // 阶段一生成的订单ID(必填)
|
||
Name string `json:"name"` // 藏品名称(可选)
|
||
MaterialURL string `json:"material_url" binding:"required"` // 用户上传的素材URL(必填,前端已上传到OSS)
|
||
Description string `json:"description"` // 藏品描述(可选)
|
||
Grade int32 `json:"grade"` // 星册等级(可选)
|
||
Tags []string `json:"tags"` // 标签列表(可选)
|
||
MaterialType string `json:"material_type"` // 素材类型(可选)
|
||
Info string `json:"info" binding:"required"` // 藏品信息(必填)
|
||
}
|
||
|
||
// PreCreateMintOrderRequestDTO 阶段一:预创建铸造订单(返回 order_id)
|
||
type PreCreateMintOrderRequestDTO struct {
|
||
Name string `json:"name"` // 藏品名称(可选)
|
||
MaterialURL string `json:"material_url" binding:"required"` // 素材URL(必填)
|
||
Description string `json:"description"` // 描述(可选)
|
||
MaterialType string `json:"material_type"` // 素材类型(可选)
|
||
Event string `json:"event"` // 藏品事件(可选)
|
||
}
|
||
|
||
// ========== 资产相关响应 ==========
|
||
|
||
// CreateMintOrderResponseDTO 创建铸造订单响应
|
||
type CreateMintOrderResponseDTO struct {
|
||
Order MintOrderDTO `json:"order"` // 订单信息
|
||
Asset AssetDTO `json:"asset"` // 资产信息
|
||
}
|
||
|
||
// MintOrderDTO 铸造订单信息
|
||
type MintOrderDTO struct {
|
||
OrderID string `json:"order_id"` // 订单ID(UUID)
|
||
UserID int64 `json:"user_id"` // 用户ID
|
||
AssetID int64 `json:"asset_id"` // 关联资产ID
|
||
StarID int64 `json:"star_id"` // 明星ID
|
||
Status string `json:"status"` // 状态:PENDING, PROCESSING, SUCCESS, FAILED
|
||
CostCrystal int64 `json:"cost_crystal"` // 消耗的水晶数量
|
||
ErrorMessage string `json:"error_message,omitempty"` // 错误信息(可选)
|
||
RetryCount int32 `json:"retry_count"` // 重试次数
|
||
MaterialURL string `json:"material_url,omitempty"` // 阶段一保存的素材URL(可选)
|
||
Name string `json:"name,omitempty"` // 阶段一保存的名称(可选)
|
||
Description string `json:"description,omitempty"` // 阶段一保存的描述(可选)
|
||
MaterialType string `json:"material_type,omitempty"` // 素材类型(可选)
|
||
Event string `json:"event,omitempty"` // 藏品事件(可选)
|
||
CreatedAt int64 `json:"created_at"` // 创建时间(毫秒时间戳)
|
||
UpdatedAt int64 `json:"updated_at"` // 更新时间(毫秒时间戳)
|
||
MintedAt int64 `json:"minted_at,omitempty"` // 上链成功时间(毫秒时间戳,可选)
|
||
// 订单查询响应中的扩展字段
|
||
CoverURL string `json:"cover_url,omitempty"` // 封面图URL(成功时)
|
||
CoverURLSigned string `json:"cover_url_signed,omitempty"` // 封面图预签名URL(成功时)
|
||
TxHash string `json:"tx_hash,omitempty"` // 交易哈希(成功时)
|
||
}
|
||
|
||
// AssetDTO 资产详细信息
|
||
type AssetDTO struct {
|
||
AssetID int64 `json:"asset_id"` // 资产ID
|
||
OwnerUID int64 `json:"owner_uid"` // 当前持有者
|
||
OwnerNickname string `json:"owner_nickname,omitempty"` // 持有者昵称(在该star下的昵称)
|
||
StarID int64 `json:"star_id"` // 所属星球
|
||
Name string `json:"name"` // 藏品名称
|
||
CoverURL string `json:"cover_url"` // 封面图URL
|
||
CoverURLSigned string `json:"cover_url_signed,omitempty"` // 封面图预签名URL(自动生成)
|
||
MaterialURL string `json:"material_url,omitempty"` // 用户上传的素材URL
|
||
MaterialURLSigned string `json:"material_url_signed,omitempty"` // 素材图预签名URL(自动生成)
|
||
Description string `json:"description,omitempty"` // 藏品描述(可选)
|
||
Grade int32 `json:"grade,omitempty"` // 星册等级(可选)
|
||
Tags []string `json:"tags,omitempty"` // 标签数组(可选)
|
||
Visibility string `json:"visibility"` // 可见性:private, friends, public
|
||
Status int32 `json:"status"` // 状态:0=Pending, 1=Active
|
||
TxHash string `json:"tx_hash,omitempty"` // 交易哈希(可选)
|
||
BlockNumber int64 `json:"block_number,omitempty"` // 区块号(可选)
|
||
LikeCount int32 `json:"like_count"` // 点赞数
|
||
CreatedAt int64 `json:"created_at"` // 创建时间(毫秒时间戳)
|
||
UpdatedAt int64 `json:"updated_at"` // 更新时间(毫秒时间戳)
|
||
MintedAt int64 `json:"minted_at,omitempty"` // 上链成功时间(毫秒时间戳,可选)
|
||
Owner *OwnerInfoDTO `json:"owner,omitempty"` // 持有者信息(可选,保留用于兼容性)
|
||
IsLiked bool `json:"is_liked"` // 当前用户是否已点赞
|
||
Info string `json:"info"` // 藏品信息
|
||
}
|
||
|
||
// OwnerInfoDTO 持有者信息
|
||
type OwnerInfoDTO struct {
|
||
UserID int64 `json:"user_id"` // 用户ID
|
||
Nickname string `json:"nickname"` // 昵称
|
||
Avatar string `json:"avatar"` // 头像URL
|
||
}
|
||
|
||
// GetMyAssetsResponseDTO 获取我的藏品列表响应
|
||
type GetMyAssetsResponseDTO struct {
|
||
Data *AssetListDataDTO `json:"data"` // 分组后的藏品数据
|
||
}
|
||
|
||
// AssetListDataDTO 藏品列表数据(与星册home一致的结构)
|
||
type AssetListDataDTO struct {
|
||
Groups []AssetGroupDTO `json:"groups"` // 分组列表
|
||
Total int64 `json:"total"` // 总数
|
||
Page int32 `json:"page"` // 当前页码
|
||
PageSize int32 `json:"page_size"` // 每页数量
|
||
HasMore bool `json:"has_more"` // 是否有更多
|
||
}
|
||
|
||
// AssetGroupDTO 资产分组(与星册home一致)
|
||
type AssetGroupDTO struct {
|
||
Type string `json:"type"` // 'regular' / 'collection' / 'activity'
|
||
Category string `json:"category"` // 'castlove'(regular) / collection_category / activity_type
|
||
CategoryName string `json:"category_name"` // 分组名称
|
||
Grades []GradeSectionDTO `json:"grades"` // 仅 regular 时有效
|
||
Items []AssetItemDTO `json:"items"` // collection / activity 时有效
|
||
TotalCount int32 `json:"total_count"` // 总数
|
||
HasMore bool `json:"has_more"` // 是否有更多
|
||
}
|
||
|
||
// GradeSectionDTO 等级分组(仅 regular 类型使用)
|
||
type GradeSectionDTO struct {
|
||
Grade int32 `json:"grade"` // 等级:1/2/3/4/5...
|
||
Items []AssetItemDTO `json:"items"` // 藏品列表
|
||
TotalCount int32 `json:"total_count"` // 该等级总数
|
||
HasMore bool `json:"has_more"` // 是否有更多
|
||
}
|
||
|
||
// AssetItemDTO 资产项(与星册home一致)
|
||
type AssetItemDTO struct {
|
||
AssetID int64 `json:"asset_id"` // 资产ID
|
||
Name string `json:"name"` // 藏品名称
|
||
CoverURLSigned string `json:"cover_url_signed"` // 预签名封面URL
|
||
LikeCount int32 `json:"like_count"` // 点赞数
|
||
CreatedAt int64 `json:"created_at"` // 创建时间
|
||
Category string `json:"category"` // 分类
|
||
Grade int32 `json:"grade"` // 等级(仅 regular 时有效)
|
||
DisplayStatus int32 `json:"display_status"` // 展示状态:0=待展示, 1=已展示
|
||
}
|
||
|
||
// AssetListItemDTO 资产列表项(简化版,用于列表展示)
|
||
type AssetListItemDTO struct {
|
||
AssetID int64 `json:"asset_id"` // 资产ID
|
||
Name string `json:"name"` // 藏品名称
|
||
CoverURL string `json:"cover_url"` // 封面图URL
|
||
Status string `json:"status"` // 状态:pending, minting, minted, failed
|
||
TxHash string `json:"tx_hash,omitempty"` // 交易哈希(可选)
|
||
CreatedAt int64 `json:"created_at"` // 创建时间(毫秒时间戳)
|
||
MintedAt int64 `json:"minted_at,omitempty"` // 上链成功时间(毫秒时间戳,可选)
|
||
LikeCount int32 `json:"like_count"` // 点赞数
|
||
}
|
||
|
||
// GetAssetResponseDTO 获取资产详情响应
|
||
type GetAssetResponseDTO struct {
|
||
Asset AssetDTO `json:"asset"` // 资产详细信息(包含is_liked字段)
|
||
}
|
||
|
||
// GetAssetStatusResponseDTO 查询上链状态响应
|
||
type GetAssetStatusResponseDTO struct {
|
||
AssetID int64 `json:"asset_id"` // 资产ID
|
||
Status string `json:"status"` // 状态:pending, minting, minted, failed
|
||
TxHash string `json:"tx_hash,omitempty"` // 交易哈希(可选)
|
||
BlockNumber int64 `json:"block_number,omitempty"` // 区块号(可选)
|
||
MintedAt int64 `json:"minted_at,omitempty"` // 上链成功时间(毫秒时间戳,可选)
|
||
ErrorMessage string `json:"error_message,omitempty"` // 错误信息(如果失败,可选)
|
||
}
|
||
|
||
// GetMintOrderResponseDTO 查询铸造订单状态响应
|
||
type GetMintOrderResponseDTO struct {
|
||
Order MintOrderDTO `json:"order"` // 订单信息
|
||
Asset *AssetDTO `json:"asset,omitempty"` // 关联的资产信息(如果存在)
|
||
}
|