38 lines
835 B
Go
38 lines
835 B
Go
|
|
package routes
|
||
|
|
|
||
|
|
import (
|
||
|
|
"tyapi-server/internal/infrastructure/http/handlers"
|
||
|
|
sharedhttp "tyapi-server/internal/shared/http"
|
||
|
|
|
||
|
|
"go.uber.org/zap"
|
||
|
|
)
|
||
|
|
|
||
|
|
// AIProductRoutes AI产品接口路由
|
||
|
|
type AIProductRoutes struct {
|
||
|
|
productHandler *handlers.ProductHandler
|
||
|
|
logger *zap.Logger
|
||
|
|
}
|
||
|
|
|
||
|
|
// NewAIProductRoutes 创建AI产品路由
|
||
|
|
func NewAIProductRoutes(
|
||
|
|
productHandler *handlers.ProductHandler,
|
||
|
|
logger *zap.Logger,
|
||
|
|
) *AIProductRoutes {
|
||
|
|
return &AIProductRoutes{
|
||
|
|
productHandler: productHandler,
|
||
|
|
logger: logger,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// Register 注册AI产品相关路由
|
||
|
|
func (r *AIProductRoutes) Register(router *sharedhttp.GinRouter) {
|
||
|
|
engine := router.GetEngine()
|
||
|
|
|
||
|
|
aiProducts := engine.Group("/api/v1/ai/products")
|
||
|
|
{
|
||
|
|
aiProducts.GET("", r.productHandler.ListProductsForAI)
|
||
|
|
}
|
||
|
|
|
||
|
|
r.logger.Info("AI产品路由注册完成")
|
||
|
|
}
|