Files
tyapi-server/internal/application/finance/dto/commands/finance_commands.go

70 lines
2.3 KiB
Go
Raw Normal View History

2025-07-13 16:36:20 +08:00
package commands
import (
"time"
"github.com/shopspring/decimal"
)
// CreateWalletCommand 创建钱包命令
type CreateWalletCommand struct {
2025-07-20 20:53:26 +08:00
UserID string `json:"user_id" binding:"required,uuid"`
2025-07-13 16:36:20 +08:00
}
// UpdateWalletCommand 更新钱包命令
type UpdateWalletCommand struct {
2025-07-20 20:53:26 +08:00
UserID string `json:"user_id" binding:"required,uuid"`
Balance decimal.Decimal `json:"balance" binding:"omitempty"`
2025-07-13 16:36:20 +08:00
IsActive *bool `json:"is_active"`
}
// RechargeWalletCommand 充值钱包命令
type RechargeWalletCommand struct {
2025-07-20 20:53:26 +08:00
UserID string `json:"user_id" binding:"required,uuid"`
Amount decimal.Decimal `json:"amount" binding:"required,gt=0"`
2025-07-13 16:36:20 +08:00
}
// RechargeCommand 充值命令
type RechargeCommand struct {
2025-07-20 20:53:26 +08:00
UserID string `json:"user_id" binding:"required,uuid"`
Amount decimal.Decimal `json:"amount" binding:"required,gt=0"`
2025-07-13 16:36:20 +08:00
}
// WithdrawWalletCommand 提现钱包命令
type WithdrawWalletCommand struct {
2025-07-20 20:53:26 +08:00
UserID string `json:"user_id" binding:"required,uuid"`
Amount decimal.Decimal `json:"amount" binding:"required,gt=0"`
2025-07-13 16:36:20 +08:00
}
// WithdrawCommand 提现命令
type WithdrawCommand struct {
2025-07-20 20:53:26 +08:00
UserID string `json:"user_id" binding:"required,uuid"`
Amount decimal.Decimal `json:"amount" binding:"required,gt=0"`
2025-07-13 16:36:20 +08:00
}
// CreateUserSecretsCommand 创建用户密钥命令
type CreateUserSecretsCommand struct {
2025-07-20 20:53:26 +08:00
UserID string `json:"user_id" binding:"required,uuid"`
ExpiresAt *time.Time `json:"expires_at" binding:"omitempty"`
2025-07-13 16:36:20 +08:00
}
// RegenerateAccessKeyCommand 重新生成访问密钥命令
type RegenerateAccessKeyCommand struct {
2025-07-20 20:53:26 +08:00
UserID string `json:"user_id" binding:"required,uuid"`
ExpiresAt *time.Time `json:"expires_at" binding:"omitempty"`
2025-07-13 16:36:20 +08:00
}
// DeactivateUserSecretsCommand 停用用户密钥命令
type DeactivateUserSecretsCommand struct {
2025-07-20 20:53:26 +08:00
UserID string `json:"user_id" binding:"required,uuid"`
2025-07-13 16:36:20 +08:00
}
// WalletTransactionCommand 钱包交易命令
type WalletTransactionCommand struct {
2025-07-20 20:53:26 +08:00
UserID string `json:"user_id" binding:"required,uuid"`
FromUserID string `json:"from_user_id" binding:"required,uuid"`
ToUserID string `json:"to_user_id" binding:"required,uuid"`
Amount decimal.Decimal `json:"amount" binding:"required,gt=0"`
Notes string `json:"notes" binding:"omitempty,max=200"`
2025-07-13 16:36:20 +08:00
}