141 lines
5.4 KiB
Go
141 lines
5.4 KiB
Go
package dto
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
// WalletInfo 钱包信息
|
|
type WalletInfo struct {
|
|
ID string `json:"id"` // 钱包ID
|
|
UserID string `json:"user_id"` // 用户ID
|
|
IsActive bool `json:"is_active"` // 是否激活
|
|
Balance decimal.Decimal `json:"balance"` // 余额
|
|
CreatedAt time.Time `json:"created_at"` // 创建时间
|
|
UpdatedAt time.Time `json:"updated_at"` // 更新时间
|
|
}
|
|
|
|
// UserSecretsInfo 用户密钥信息
|
|
type UserSecretsInfo struct {
|
|
ID string `json:"id"` // 密钥ID
|
|
UserID string `json:"user_id"` // 用户ID
|
|
AccessID string `json:"access_id"` // 访问ID
|
|
AccessKey string `json:"access_key"` // 访问密钥
|
|
IsActive bool `json:"is_active"` // 是否激活
|
|
LastUsedAt *time.Time `json:"last_used_at"` // 最后使用时间
|
|
ExpiresAt *time.Time `json:"expires_at"` // 过期时间
|
|
CreatedAt time.Time `json:"created_at"` // 创建时间
|
|
UpdatedAt time.Time `json:"updated_at"` // 更新时间
|
|
}
|
|
|
|
// CreateWalletRequest 创建钱包请求
|
|
type CreateWalletRequest struct {
|
|
UserID string `json:"user_id" binding:"required"` // 用户ID
|
|
}
|
|
|
|
// CreateWalletResponse 创建钱包响应
|
|
type CreateWalletResponse struct {
|
|
Wallet WalletInfo `json:"wallet"` // 钱包信息
|
|
}
|
|
|
|
// GetWalletRequest 获取钱包请求
|
|
type GetWalletRequest struct {
|
|
UserID string `form:"user_id" binding:"required"` // 用户ID
|
|
}
|
|
|
|
// UpdateWalletRequest 更新钱包请求
|
|
type UpdateWalletRequest struct {
|
|
UserID string `json:"user_id" binding:"required"` // 用户ID
|
|
Balance decimal.Decimal `json:"balance"` // 余额
|
|
IsActive *bool `json:"is_active"` // 是否激活
|
|
}
|
|
|
|
// RechargeRequest 充值请求
|
|
type RechargeRequest struct {
|
|
UserID string `json:"user_id" binding:"required"` // 用户ID
|
|
Amount decimal.Decimal `json:"amount" binding:"required"` // 充值金额
|
|
}
|
|
|
|
// RechargeResponse 充值响应
|
|
type RechargeResponse struct {
|
|
WalletID string `json:"wallet_id"` // 钱包ID
|
|
Amount decimal.Decimal `json:"amount"` // 充值金额
|
|
Balance decimal.Decimal `json:"balance"` // 充值后余额
|
|
}
|
|
|
|
// WithdrawRequest 提现请求
|
|
type WithdrawRequest struct {
|
|
UserID string `json:"user_id" binding:"required"` // 用户ID
|
|
Amount decimal.Decimal `json:"amount" binding:"required"` // 提现金额
|
|
}
|
|
|
|
// WithdrawResponse 提现响应
|
|
type WithdrawResponse struct {
|
|
WalletID string `json:"wallet_id"` // 钱包ID
|
|
Amount decimal.Decimal `json:"amount"` // 提现金额
|
|
Balance decimal.Decimal `json:"balance"` // 提现后余额
|
|
}
|
|
|
|
// CreateUserSecretsRequest 创建用户密钥请求
|
|
type CreateUserSecretsRequest struct {
|
|
UserID string `json:"user_id" binding:"required"` // 用户ID
|
|
ExpiresAt *time.Time `json:"expires_at"` // 过期时间
|
|
}
|
|
|
|
// CreateUserSecretsResponse 创建用户密钥响应
|
|
type CreateUserSecretsResponse struct {
|
|
Secrets UserSecretsInfo `json:"secrets"` // 密钥信息
|
|
}
|
|
|
|
// GetUserSecretsRequest 获取用户密钥请求
|
|
type GetUserSecretsRequest struct {
|
|
UserID string `form:"user_id" binding:"required"` // 用户ID
|
|
}
|
|
|
|
// RegenerateAccessKeyRequest 重新生成访问密钥请求
|
|
type RegenerateAccessKeyRequest struct {
|
|
UserID string `json:"user_id" binding:"required"` // 用户ID
|
|
ExpiresAt *time.Time `json:"expires_at"` // 过期时间
|
|
}
|
|
|
|
// RegenerateAccessKeyResponse 重新生成访问密钥响应
|
|
type RegenerateAccessKeyResponse struct {
|
|
AccessID string `json:"access_id"` // 新的访问ID
|
|
AccessKey string `json:"access_key"` // 新的访问密钥
|
|
}
|
|
|
|
// DeactivateUserSecretsRequest 停用用户密钥请求
|
|
type DeactivateUserSecretsRequest struct {
|
|
UserID string `json:"user_id" binding:"required"` // 用户ID
|
|
}
|
|
|
|
// WalletTransactionRequest 钱包交易请求
|
|
type WalletTransactionRequest struct {
|
|
FromUserID string `json:"from_user_id" binding:"required"` // 转出用户ID
|
|
ToUserID string `json:"to_user_id" binding:"required"` // 转入用户ID
|
|
Amount decimal.Decimal `json:"amount" binding:"required"` // 交易金额
|
|
Notes string `json:"notes"` // 交易备注
|
|
}
|
|
|
|
// WalletTransactionResponse 钱包交易响应
|
|
type WalletTransactionResponse struct {
|
|
TransactionID string `json:"transaction_id"` // 交易ID
|
|
FromUserID string `json:"from_user_id"` // 转出用户ID
|
|
ToUserID string `json:"to_user_id"` // 转入用户ID
|
|
Amount decimal.Decimal `json:"amount"` // 交易金额
|
|
FromBalance decimal.Decimal `json:"from_balance"` // 转出后余额
|
|
ToBalance decimal.Decimal `json:"to_balance"` // 转入后余额
|
|
Notes string `json:"notes"` // 交易备注
|
|
CreatedAt time.Time `json:"created_at"` // 交易时间
|
|
}
|
|
|
|
// WalletStatsResponse 钱包统计响应
|
|
type WalletStatsResponse struct {
|
|
TotalWallets int64 `json:"total_wallets"` // 总钱包数
|
|
ActiveWallets int64 `json:"active_wallets"` // 激活钱包数
|
|
TotalBalance decimal.Decimal `json:"total_balance"` // 总余额
|
|
TodayTransactions int64 `json:"today_transactions"` // 今日交易数
|
|
TodayVolume decimal.Decimal `json:"today_volume"` // 今日交易量
|
|
}
|