78 lines
4.2 KiB
Go
78 lines
4.2 KiB
Go
package product
|
|
|
|
import (
|
|
"context"
|
|
"tyapi-server/internal/application/product/dto/commands"
|
|
"tyapi-server/internal/application/product/dto/queries"
|
|
"tyapi-server/internal/application/product/dto/responses"
|
|
)
|
|
|
|
// ProductApplicationService 产品应用服务接口
|
|
type ProductApplicationService interface {
|
|
// 产品管理
|
|
CreateProduct(ctx context.Context, cmd *commands.CreateProductCommand) error
|
|
UpdateProduct(ctx context.Context, cmd *commands.UpdateProductCommand) error
|
|
DeleteProduct(ctx context.Context, cmd *commands.DeleteProductCommand) error
|
|
GetProductByID(ctx context.Context, query *queries.GetProductQuery) (*responses.ProductInfoResponse, error)
|
|
ListProducts(ctx context.Context, query *queries.ListProductsQuery) (*responses.ProductListResponse, error)
|
|
GetProductsByIDs(ctx context.Context, query *queries.GetProductsByIDsQuery) ([]*responses.ProductInfoResponse, error)
|
|
|
|
// 产品状态管理
|
|
EnableProduct(ctx context.Context, cmd *commands.EnableProductCommand) error
|
|
DisableProduct(ctx context.Context, cmd *commands.DisableProductCommand) error
|
|
ShowProduct(ctx context.Context, cmd *commands.ShowProductCommand) error
|
|
HideProduct(ctx context.Context, cmd *commands.HideProductCommand) error
|
|
|
|
// SEO管理
|
|
UpdateProductSEO(ctx context.Context, cmd *commands.UpdateProductSEOCommand) error
|
|
|
|
// 业务查询
|
|
GetSubscribableProducts(ctx context.Context, query *queries.GetSubscribableProductsQuery) ([]*responses.ProductInfoResponse, error)
|
|
GetProductStats(ctx context.Context) (*responses.ProductStatsResponse, error)
|
|
}
|
|
|
|
// CategoryApplicationService 分类应用服务接口
|
|
type CategoryApplicationService interface {
|
|
// 分类管理
|
|
CreateCategory(ctx context.Context, cmd *commands.CreateCategoryCommand) error
|
|
UpdateCategory(ctx context.Context, cmd *commands.UpdateCategoryCommand) error
|
|
DeleteCategory(ctx context.Context, cmd *commands.DeleteCategoryCommand) error
|
|
GetCategoryByID(ctx context.Context, query *queries.GetCategoryQuery) (*responses.CategoryInfoResponse, error)
|
|
ListCategories(ctx context.Context, query *queries.ListCategoriesQuery) (*responses.CategoryListResponse, error)
|
|
|
|
// 分类状态管理
|
|
EnableCategory(ctx context.Context, cmd *commands.EnableCategoryCommand) error
|
|
DisableCategory(ctx context.Context, cmd *commands.DisableCategoryCommand) error
|
|
ShowCategory(ctx context.Context, cmd *commands.ShowCategoryCommand) error
|
|
HideCategory(ctx context.Context, cmd *commands.HideCategoryCommand) error
|
|
|
|
// 分类结构管理
|
|
MoveCategory(ctx context.Context, cmd *commands.MoveCategoryCommand) error
|
|
GetCategoryTree(ctx context.Context, query *queries.GetCategoryTreeQuery) (*responses.CategoryTreeResponse, error)
|
|
GetCategoriesByLevel(ctx context.Context, query *queries.GetCategoriesByLevelQuery) ([]*responses.CategoryInfoResponse, error)
|
|
GetCategoryPath(ctx context.Context, query *queries.GetCategoryPathQuery) (*responses.CategoryPathResponse, error)
|
|
|
|
// 统计
|
|
GetCategoryStats(ctx context.Context) (*responses.CategoryStatsResponse, error)
|
|
}
|
|
|
|
// SubscriptionApplicationService 订阅应用服务接口
|
|
type SubscriptionApplicationService interface {
|
|
// 订阅管理
|
|
CreateSubscription(ctx context.Context, cmd *commands.CreateSubscriptionCommand) error
|
|
UpdateSubscription(ctx context.Context, cmd *commands.UpdateSubscriptionCommand) error
|
|
GetSubscriptionByID(ctx context.Context, query *queries.GetSubscriptionQuery) (*responses.SubscriptionInfoResponse, error)
|
|
ListSubscriptions(ctx context.Context, query *queries.ListSubscriptionsQuery) (*responses.SubscriptionListResponse, error)
|
|
|
|
// API使用管理
|
|
UpdateAPIUsage(ctx context.Context, cmd *commands.UpdateAPIUsageCommand) error
|
|
ResetAPIUsage(ctx context.Context, cmd *commands.ResetAPIUsageCommand) error
|
|
|
|
// 业务查询
|
|
GetUserSubscriptions(ctx context.Context, query *queries.GetUserSubscriptionsQuery) ([]*responses.SubscriptionInfoResponse, error)
|
|
GetProductSubscriptions(ctx context.Context, query *queries.GetProductSubscriptionsQuery) ([]*responses.SubscriptionInfoResponse, error)
|
|
GetSubscriptionUsage(ctx context.Context, subscriptionID string) (*responses.SubscriptionUsageResponse, error)
|
|
|
|
// 统计
|
|
GetSubscriptionStats(ctx context.Context) (*responses.SubscriptionStatsResponse, error)
|
|
} |