This commit is contained in:
2025-07-15 13:21:34 +08:00
parent 807004f78d
commit 83bf9aea7d
44 changed files with 9798 additions and 8 deletions

View File

@@ -0,0 +1,35 @@
package queries
// ListCategoriesQuery 分类列表查询
type ListCategoriesQuery struct {
Page int `form:"page" binding:"min=1" comment:"页码"`
PageSize int `form:"page_size" binding:"min=1,max=100" comment:"每页数量"`
ParentID *string `form:"parent_id" comment:"父分类ID"`
Level *int `form:"level" comment:"分类层级"`
IsEnabled *bool `form:"is_enabled" comment:"是否启用"`
IsVisible *bool `form:"is_visible" comment:"是否展示"`
SortBy string `form:"sort_by" comment:"排序字段"`
SortOrder string `form:"sort_order" comment:"排序方向"`
}
// GetCategoryQuery 获取分类详情查询
type GetCategoryQuery struct {
ID string `uri:"id" comment:"分类ID"`
Code string `form:"code" comment:"分类编号"`
}
// GetCategoryTreeQuery 获取分类树查询
type GetCategoryTreeQuery struct {
IncludeDisabled bool `form:"include_disabled" comment:"是否包含禁用分类"`
IncludeHidden bool `form:"include_hidden" comment:"是否包含隐藏分类"`
}
// GetCategoriesByLevelQuery 根据层级获取分类查询
type GetCategoriesByLevelQuery struct {
Level int `form:"level" binding:"min=1" comment:"分类层级"`
}
// GetCategoryPathQuery 获取分类路径查询
type GetCategoryPathQuery struct {
CategoryID string `uri:"category_id" binding:"required" comment:"分类ID"`
}

View File

@@ -0,0 +1,47 @@
package queries
// ListProductsQuery 产品列表查询
type ListProductsQuery struct {
Page int `form:"page" binding:"min=1" comment:"页码"`
PageSize int `form:"page_size" binding:"min=1,max=100" comment:"每页数量"`
Keyword string `form:"keyword" comment:"搜索关键词"`
CategoryID string `form:"category_id" comment:"分类ID"`
MinPrice *float64 `form:"min_price" comment:"最低价格"`
MaxPrice *float64 `form:"max_price" comment:"最高价格"`
IsEnabled *bool `form:"is_enabled" comment:"是否启用"`
IsVisible *bool `form:"is_visible" comment:"是否展示"`
IsPackage *bool `form:"is_package" comment:"是否组合包"`
SortBy string `form:"sort_by" comment:"排序字段"`
SortOrder string `form:"sort_order" comment:"排序方向"`
}
// SearchProductsQuery 产品搜索查询
type SearchProductsQuery struct {
Page int `form:"page" binding:"min=1" comment:"页码"`
PageSize int `form:"page_size" binding:"min=1,max=100" comment:"每页数量"`
Keyword string `form:"keyword" comment:"搜索关键词"`
CategoryID string `form:"category_id" comment:"分类ID"`
MinPrice *float64 `form:"min_price" comment:"最低价格"`
MaxPrice *float64 `form:"max_price" comment:"最高价格"`
IsEnabled *bool `form:"is_enabled" comment:"是否启用"`
IsVisible *bool `form:"is_visible" comment:"是否展示"`
IsPackage *bool `form:"is_package" comment:"是否组合包"`
SortBy string `form:"sort_by" comment:"排序字段"`
SortOrder string `form:"sort_order" comment:"排序方向"`
}
// GetProductQuery 获取产品详情查询
type GetProductQuery struct {
ID string `uri:"id" comment:"产品ID"`
Code string `form:"code" comment:"产品编号"`
}
// GetProductsByIDsQuery 根据ID列表获取产品查询
type GetProductsByIDsQuery struct {
IDs []string `form:"ids" binding:"required" comment:"产品ID列表"`
}
// GetSubscribableProductsQuery 获取可订阅产品查询
type GetSubscribableProductsQuery struct {
UserID string `form:"user_id" binding:"required" comment:"用户ID"`
}

View File

@@ -0,0 +1,36 @@
package queries
import "tyapi-server/internal/domains/product/entities"
// ListSubscriptionsQuery 订阅列表查询
type ListSubscriptionsQuery struct {
Page int `form:"page" binding:"min=1" comment:"页码"`
PageSize int `form:"page_size" binding:"min=1,max=100" comment:"每页数量"`
UserID string `form:"user_id" comment:"用户ID"`
ProductID string `form:"product_id" comment:"产品ID"`
Status entities.SubscriptionStatus `form:"status" comment:"订阅状态"`
SortBy string `form:"sort_by" comment:"排序字段"`
SortOrder string `form:"sort_order" comment:"排序方向"`
}
// GetSubscriptionQuery 获取订阅详情查询
type GetSubscriptionQuery struct {
ID string `uri:"id" binding:"required" comment:"订阅ID"`
}
// GetUserSubscriptionsQuery 获取用户订阅查询
type GetUserSubscriptionsQuery struct {
UserID string `form:"user_id" binding:"required" comment:"用户ID"`
Status *entities.SubscriptionStatus `form:"status" comment:"订阅状态"`
}
// GetProductSubscriptionsQuery 获取产品订阅查询
type GetProductSubscriptionsQuery struct {
ProductID string `form:"product_id" binding:"required" comment:"产品ID"`
Status *entities.SubscriptionStatus `form:"status" comment:"订阅状态"`
}
// GetActiveSubscriptionsQuery 获取活跃订阅查询
type GetActiveSubscriptionsQuery struct {
UserID string `form:"user_id" comment:"用户ID"`
}