Compare commits
3 Commits
7fdfa02189
...
6b902f68f1
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b902f68f1 | |||
| 745fbc05d5 | |||
| 6618e35869 |
@@ -571,6 +571,7 @@ func (s *ComponentReportOrderService) createFreeOrder(
|
||||
ProductName: product.Name,
|
||||
OrderID: &createdPurchaseOrder.ID, // 关联购买订单ID
|
||||
OrderNumber: &createdPurchaseOrder.OrderNo, // 外部订单号
|
||||
DownloadPrice: finalPrice, // 设置下载价格
|
||||
ExpiresAt: calculateExpiryTime(), // 30天后过期
|
||||
}
|
||||
|
||||
@@ -785,6 +786,7 @@ func (s *ComponentReportOrderService) DownloadFile(ctx context.Context, orderID
|
||||
ProductName: product.Name,
|
||||
OrderID: &purchaseOrder.ID,
|
||||
OrderNumber: &purchaseOrder.OrderNo,
|
||||
DownloadPrice: purchaseOrder.Amount, // 设置下载价格(从订单获取)
|
||||
ExpiresAt: calculateExpiryTime(),
|
||||
}
|
||||
|
||||
@@ -924,6 +926,7 @@ func (s *ComponentReportOrderService) createDownloadRecordForPaidOrder(ctx conte
|
||||
ProductName: product.Name,
|
||||
OrderID: &purchaseOrder.ID,
|
||||
OrderNumber: &purchaseOrder.OrderNo,
|
||||
DownloadPrice: purchaseOrder.Amount, // 设置下载价格(从订单获取)
|
||||
ExpiresAt: calculateExpiryTime(), // 30天后过期
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/shopspring/decimal"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -22,6 +23,9 @@ type ComponentReportDownload struct {
|
||||
SubProductIDs string `gorm:"type:text" comment:"子产品ID列表(JSON数组,组合包使用)"`
|
||||
SubProductCodes string `gorm:"type:text" comment:"子产品编号列表(JSON数组)"`
|
||||
|
||||
// 价格相关字段
|
||||
DownloadPrice decimal.Decimal `gorm:"type:decimal(10,2);not null" comment:"实际支付价格"`
|
||||
|
||||
// 下载相关信息
|
||||
FilePath *string `gorm:"type:varchar(500)" comment:"生成的ZIP文件路径(用于二次下载)"`
|
||||
FileHash *string `gorm:"type:varchar(64)" comment:"文件哈希值(用于缓存验证)"`
|
||||
|
||||
@@ -989,6 +989,7 @@ func (h *ComponentReportHandler) CreatePaymentOrder(c *gin.Context) {
|
||||
// 关联购买订单ID
|
||||
OrderID: &createdPurchaseOrder.ID,
|
||||
OrderNumber: &outTradeNo,
|
||||
DownloadPrice: finalPrice, // 设置下载价格
|
||||
}
|
||||
|
||||
// 记录创建前的详细信息用于调试
|
||||
@@ -1390,6 +1391,7 @@ func (h *ComponentReportHandler) createDownloadRecordIfEligible(ctx context.Cont
|
||||
ProductName: product.Name,
|
||||
OrderID: &validOrder.ID, // 添加OrderID字段
|
||||
OrderNumber: &validOrder.OrderNo, // 使用OrderNumber字段
|
||||
DownloadPrice: validOrder.Amount, // 设置下载价格(从订单获取)
|
||||
ExpiresAt: calculateExpiryTime(), // 从创建日起30天
|
||||
}
|
||||
|
||||
@@ -1568,6 +1570,7 @@ func (h *ComponentReportHandler) createDownloadRecordForPaidOrder(ctx context.Co
|
||||
ProductName: order.ProductName,
|
||||
OrderID: &order.ID,
|
||||
OrderNumber: &order.OrderNo,
|
||||
DownloadPrice: order.Amount, // 设置下载价格(从订单获取)
|
||||
ExpiresAt: calculateExpiryTime(),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user