add购买记录功能

This commit is contained in:
2025-12-22 18:32:34 +08:00
parent 65a61d0336
commit 7f8554fa12
314 changed files with 4029 additions and 83496 deletions

View File

@@ -0,0 +1,58 @@
package routes
import (
"tyapi-server/internal/infrastructure/http/handlers"
sharedhttp "tyapi-server/internal/shared/http"
"tyapi-server/internal/shared/middleware"
"go.uber.org/zap"
)
// ComponentReportOrderRoutes 组件报告订单路由
type ComponentReportOrderRoutes struct {
componentReportOrderHandler *handlers.ComponentReportOrderHandler
auth *middleware.JWTAuthMiddleware
logger *zap.Logger
}
// NewComponentReportOrderRoutes 创建组件报告订单路由
func NewComponentReportOrderRoutes(
componentReportOrderHandler *handlers.ComponentReportOrderHandler,
auth *middleware.JWTAuthMiddleware,
logger *zap.Logger,
) *ComponentReportOrderRoutes {
return &ComponentReportOrderRoutes{
componentReportOrderHandler: componentReportOrderHandler,
auth: auth,
logger: logger,
}
}
// Register 注册组件报告订单相关路由
func (r *ComponentReportOrderRoutes) Register(router *sharedhttp.GinRouter) {
engine := router.GetEngine()
// 产品组件报告相关接口 - 需要认证
componentReportGroup := engine.Group("/api/v1/products/:id/component-report", r.auth.Handle())
{
// 检查下载可用性
componentReportGroup.GET("/check", r.componentReportOrderHandler.CheckDownloadAvailability)
// 获取下载信息
componentReportGroup.GET("/info", r.componentReportOrderHandler.GetDownloadInfo)
// 创建支付订单
componentReportGroup.POST("/create-order", r.componentReportOrderHandler.CreatePaymentOrder)
}
// 组件报告订单相关接口 - 需要认证
componentReportOrder := engine.Group("/api/v1/component-report", r.auth.Handle())
{
// 检查支付状态
componentReportOrder.GET("/check-payment/:orderId", r.componentReportOrderHandler.CheckPaymentStatus)
// 下载文件
componentReportOrder.GET("/download/:orderId", r.componentReportOrderHandler.DownloadFile)
// 获取用户订单列表
componentReportOrder.GET("/orders", r.componentReportOrderHandler.GetUserOrders)
}
r.logger.Info("组件报告订单路由注册完成")
}

View File

@@ -69,6 +69,7 @@ func (r *FinanceRoutes) Register(router *sharedhttp.GinRouter) {
walletGroup.GET("/recharge-records", r.financeHandler.GetUserRechargeRecords) // 用户充值记录分页
walletGroup.GET("/alipay-order-status", r.financeHandler.GetAlipayOrderStatus) // 获取支付宝订单状态
walletGroup.GET("/wechat-order-status", r.financeHandler.GetWechatOrderStatus) // 获取微信订单状态
financeGroup.GET("/purchase-records", r.financeHandler.GetUserPurchaseRecords) // 用户购买记录分页
}
}
@@ -91,6 +92,7 @@ func (r *FinanceRoutes) Register(router *sharedhttp.GinRouter) {
adminFinanceGroup.POST("/transfer-recharge", r.financeHandler.TransferRecharge) // 对公转账充值
adminFinanceGroup.POST("/gift-recharge", r.financeHandler.GiftRecharge) // 赠送充值
adminFinanceGroup.GET("/recharge-records", r.financeHandler.GetAdminRechargeRecords) // 管理员充值记录分页
adminFinanceGroup.GET("/purchase-records", r.financeHandler.GetAdminPurchaseRecords) // 管理员购买记录分页
}
// 管理员发票相关路由组

View File

@@ -81,8 +81,6 @@ func (r *ProductAdminRoutes) Register(router *sharedhttp.GinRouter) {
subscriptions.POST("/batch-update-prices", r.handler.BatchUpdateSubscriptionPrices)
}
// 消费记录管理
walletTransactions := adminGroup.Group("/wallet-transactions")
{

View File

@@ -70,14 +70,7 @@ func (r *ProductRoutes) Register(router *sharedhttp.GinRouter) {
componentReport.POST("/generate-and-download", r.componentReportHandler.GenerateAndDownloadZip)
}
// 产品组件报告相关接口 - 需要认证
componentReportGroup := products.Group("/:id/component-report", r.auth.Handle())
{
componentReportGroup.GET("/check", r.componentReportHandler.CheckDownloadAvailability)
componentReportGroup.GET("/info", r.componentReportHandler.GetDownloadInfo)
componentReportGroup.POST("/create-order", r.componentReportHandler.CreatePaymentOrder)
componentReportGroup.GET("/check-payment/:orderId", r.componentReportHandler.CheckPaymentStatus)
}
// 产品组件报告相关接口 - 已迁移到 ComponentReportOrderRoutes
// 分类 - 公开接口
categories := engine.Group("/api/v1/categories")