This commit is contained in:
2026-01-16 18:37:47 +08:00
parent 96dfa3d758
commit 96d530a67d
12 changed files with 959 additions and 156 deletions

View File

@@ -712,6 +712,13 @@ func (s *ComponentReportOrderService) DownloadFile(ctx context.Context, orderID
zap.String("product_id", purchaseOrder.ProductID))
// 创建新的下载记录
// 设置原始价格组合包使用UIComponentPrice单品使用Price
var originalPrice decimal.Decimal
if product.IsPackage {
originalPrice = product.UIComponentPrice
} else {
originalPrice = product.Price
}
newDownload := &productEntities.ComponentReportDownload{
UserID: purchaseOrder.UserID,
ProductID: purchaseOrder.ProductID,
@@ -719,6 +726,7 @@ func (s *ComponentReportOrderService) DownloadFile(ctx context.Context, orderID
ProductName: product.Name,
OrderID: &purchaseOrder.ID,
OrderNumber: &purchaseOrder.OrderNo,
OriginalPrice: originalPrice, // 设置原始价格
DownloadPrice: purchaseOrder.Amount, // 设置下载价格(从订单获取)
ExpiresAt: calculateExpiryTime(),
}
@@ -847,6 +855,13 @@ func (s *ComponentReportOrderService) createDownloadRecordForPaidOrder(ctx conte
}
// 创建新的下载记录
// 设置原始价格组合包使用UIComponentPrice单品使用Price
var originalPrice decimal.Decimal
if product.IsPackage {
originalPrice = product.UIComponentPrice
} else {
originalPrice = product.Price
}
download := &productEntities.ComponentReportDownload{
UserID: purchaseOrder.UserID,
ProductID: purchaseOrder.ProductID,
@@ -854,6 +869,7 @@ func (s *ComponentReportOrderService) createDownloadRecordForPaidOrder(ctx conte
ProductName: product.Name,
OrderID: &purchaseOrder.ID,
OrderNumber: &purchaseOrder.OrderNo,
OriginalPrice: originalPrice, // 设置原始价格
DownloadPrice: purchaseOrder.Amount, // 设置下载价格(从订单获取)
ExpiresAt: calculateExpiryTime(), // 30天后过期
}