Files
tyapi-server/internal/application/product/dto/commands/subscription_commands.go

57 lines
1.8 KiB
Go
Raw Normal View History

2025-07-15 13:21:34 +08:00
package commands
// CreateSubscriptionCommand 创建订阅命令
type CreateSubscriptionCommand struct {
UserID string `json:"user_id" binding:"required" comment:"用户ID"`
ProductID string `json:"product_id" binding:"required" comment:"产品ID"`
Price float64 `json:"price" binding:"min=0" comment:"订阅价格"`
APILimit int64 `json:"api_limit" comment:"API调用限制"`
AutoRenew bool `json:"auto_renew" comment:"是否自动续费"`
Duration string `json:"duration" comment:"订阅时长"`
}
// UpdateSubscriptionCommand 更新订阅命令
type UpdateSubscriptionCommand struct {
ID string `json:"-"`
Price float64 `json:"price" binding:"min=0" comment:"订阅价格"`
APILimit int64 `json:"api_limit" comment:"API调用限制"`
AutoRenew *bool `json:"auto_renew" comment:"是否自动续费"`
}
// CancelSubscriptionCommand 取消订阅命令
type CancelSubscriptionCommand struct {
ID string `json:"-"`
}
// RenewSubscriptionCommand 续费订阅命令
type RenewSubscriptionCommand struct {
ID string `json:"-"`
Duration string `json:"duration" binding:"required" comment:"续费时长"`
}
// ActivateSubscriptionCommand 激活订阅命令
type ActivateSubscriptionCommand struct {
ID string `json:"-"`
}
// DeactivateSubscriptionCommand 停用订阅命令
type DeactivateSubscriptionCommand struct {
ID string `json:"-"`
}
// UpdateAPIUsageCommand 更新API使用量命令
type UpdateAPIUsageCommand struct {
ID string `json:"-"`
APIUsed int64 `json:"api_used" binding:"min=0" comment:"API使用量"`
}
// ResetAPIUsageCommand 重置API使用量命令
type ResetAPIUsageCommand struct {
ID string `json:"-"`
}
// SetAPILimitCommand 设置API限制命令
type SetAPILimitCommand struct {
ID string `json:"-"`
APILimit int64 `json:"api_limit" binding:"min=0" comment:"API调用限制"`
}