diff --git a/server/HoneyBox/src/HoneyBox.Core/Services/OrderService.cs b/server/HoneyBox/src/HoneyBox.Core/Services/OrderService.cs
index 9f36066a..dbcf2791 100644
--- a/server/HoneyBox/src/HoneyBox.Core/Services/OrderService.cs
+++ b/server/HoneyBox/src/HoneyBox.Core/Services/OrderService.cs
@@ -105,21 +105,29 @@ public class OrderService : IOrderService
goodsExtend
);
- // 6. 构建响应
+ // 6. 构建响应(兼容 PHP 旧版字段名)
return new OrderCalculationDto
{
OrderTotal = result.OrderTotal.ToString("0.00"),
OrderZheTotal = result.OrderZheTotal.ToString("0.00"),
Price = result.Price.ToString("0.00"),
Zhe = result.Zhe.ToString("0.00"),
- UserMoney = user.Money.ToString("0.00"),
- UserIntegral = user.Integral.ToString("0.00"),
- UserMoney2 = (user.Money2 ?? 0).ToString("0.00"),
+ // 用户余额信息(兼容旧版字段名)
+ Money = user.Money.ToString("0.00"),
+ Integral = user.Integral.ToString("0.00"),
+ Score = user.Money2 ?? 0,
+ // 使用金额信息
UseMoney = result.UseMoney.ToString("0.00"),
UseIntegral = result.UseIntegral.ToString("0.00"),
- UseMoney2 = result.UseMoney2.ToString("0.00"),
- UseCoupon = result.CouponPrice.ToString("0.00"),
- GoodsInfo = new GoodsInfoDto
+ UseIntegralMoney = (result.UseIntegral / 100).ToString("0.00"),
+ UseScore = result.UseMoney2,
+ UseMoney2 = result.UseMoney2,
+ // 优惠券信息
+ CouponId = result.CouponId,
+ CouponPrice = result.CouponPrice.ToString("0.00"),
+ IsShouZhe = result.IsShouZhe ? 1 : 0,
+ // 商品信息(兼容旧版字段名 goods)
+ Goods = new GoodsInfoDto
{
Id = goods.Id,
Title = goods.Title,
@@ -128,7 +136,9 @@ public class OrderService : IOrderService
Type = goods.Type,
IsShouZhe = goods.IsShouZhe,
QuanjuXiangou = goods.QuanjuXiangou,
- DailyXiangou = goods.DailyXiangou
+ DailyXiangou = goods.DailyXiangou,
+ PrizeNum = request.PrizeNum,
+ ShouZhePrice = result.ShouZhePrice.ToString("0.00")
},
GoodsExtend = goodsExtend
};
@@ -341,7 +351,8 @@ public class OrderService : IOrderService
if (!hasPaidOrder && isShouZhe == 1)
{
shouZhePrice = Math.Round(boxPrice * 0.5m, 2);
- result.IsShouZhe = 1;
+ result.IsShouZhe = true;
+ result.ShouZhePrice = shouZhePrice;
}
}
@@ -585,7 +596,8 @@ public class OrderService : IOrderService
public decimal UseMoney2 { get; set; }
public int CouponId { get; set; }
public decimal CouponPrice { get; set; }
- public int IsShouZhe { get; set; }
+ public bool IsShouZhe { get; set; }
+ public decimal ShouZhePrice { get; set; }
}
///
@@ -665,21 +677,29 @@ public class OrderService : IOrderService
goodsExtend
);
- // 7. 构建响应
+ // 7. 构建响应(兼容 PHP 旧版字段名)
return new OrderCalculationDto
{
OrderTotal = result.OrderTotal.ToString("0.00"),
OrderZheTotal = result.OrderZheTotal.ToString("0.00"),
Price = result.Price.ToString("0.00"),
Zhe = result.Zhe.ToString("0.00"),
- UserMoney = user.Money.ToString("0.00"),
- UserIntegral = user.Integral.ToString("0.00"),
- UserMoney2 = (user.Money2 ?? 0).ToString("0.00"),
+ // 用户余额信息(兼容旧版字段名)
+ Money = user.Money.ToString("0.00"),
+ Integral = user.Integral.ToString("0.00"),
+ Score = user.Money2 ?? 0,
+ // 使用金额信息
UseMoney = result.UseMoney.ToString("0.00"),
UseIntegral = result.UseIntegral.ToString("0.00"),
- UseMoney2 = result.UseMoney2.ToString("0.00"),
- UseCoupon = result.CouponPrice.ToString("0.00"),
- GoodsInfo = new GoodsInfoDto
+ UseIntegralMoney = (result.UseIntegral / 100).ToString("0.00"),
+ UseScore = result.UseMoney2,
+ UseMoney2 = result.UseMoney2,
+ // 优惠券信息
+ CouponId = result.CouponId,
+ CouponPrice = result.CouponPrice.ToString("0.00"),
+ IsShouZhe = result.IsShouZhe ? 1 : 0,
+ // 商品信息(兼容旧版字段名 goods)
+ Goods = new GoodsInfoDto
{
Id = goods.Id,
Title = goods.Title,
@@ -688,7 +708,9 @@ public class OrderService : IOrderService
Type = goods.Type,
IsShouZhe = goods.IsShouZhe,
QuanjuXiangou = goods.QuanjuXiangou,
- DailyXiangou = goods.DailyXiangou
+ DailyXiangou = goods.DailyXiangou,
+ PrizeNum = request.PrizeNum,
+ ShouZhePrice = result.ShouZhePrice.ToString("0.00")
},
GoodsExtend = goodsExtend
};
@@ -742,20 +764,24 @@ public class OrderService : IOrderService
var integral = price * 100; // 积分价格 = 单价 * 100
var userMoney2 = user.Money2 ?? 0;
- // 5. 构建响应 - 商城订单返回格式与PHP一致
+ // 5. 构建响应(兼容 PHP 旧版字段名)
return new OrderCalculationDto
{
Price = price.ToString("0.00"),
OrderTotal = price.ToString("0.00"),
OrderZheTotal = price.ToString("0.00"),
- UserMoney = user.Money.ToString("0.00"),
- UserIntegral = user.Integral.ToString("0.00"),
- UserMoney2 = userMoney2.ToString("0.00"),
+ // 用户余额信息(兼容旧版字段名)
+ Money = user.Money.ToString("0.00"),
+ Integral = user.Integral.ToString("0.00"),
+ Score = userMoney2,
+ // 使用金额信息
UseMoney = "0.00",
UseIntegral = "0.00",
- UseMoney2 = integral.ToString("0.00"), // 需要使用的积分数量
- UseCoupon = "0.00",
- GoodsInfo = new GoodsInfoDto
+ UseIntegralMoney = "0.00",
+ UseScore = integral, // 需要使用的积分数量
+ UseMoney2 = integral,
+ // 商品信息(兼容旧版字段名 goods)
+ Goods = new GoodsInfoDto
{
Id = goods.Id,
Title = goods.Title,
@@ -992,7 +1018,7 @@ public class OrderService : IOrderService
Addtime = (int)currentTimestamp,
CouponId = paymentResult.CouponId > 0 ? paymentResult.CouponId : null,
UseCoupon = paymentResult.CouponPrice,
- IsShouZhe = (byte)paymentResult.IsShouZhe,
+ IsShouZhe = (byte)(paymentResult.IsShouZhe ? 1 : 0),
CreatedAt = DateTime.Now,
UpdatedAt = DateTime.Now
};
@@ -1369,7 +1395,7 @@ public class OrderService : IOrderService
Addtime = (int)currentTimestamp,
CouponId = paymentResult.CouponId > 0 ? paymentResult.CouponId : null,
UseCoupon = paymentResult.CouponPrice,
- IsShouZhe = (byte)paymentResult.IsShouZhe,
+ IsShouZhe = (byte)(paymentResult.IsShouZhe ? 1 : 0),
CreatedAt = DateTime.Now,
UpdatedAt = DateTime.Now
};
diff --git a/server/HoneyBox/src/HoneyBox.Model/Models/Goods/GoodsModels.cs b/server/HoneyBox/src/HoneyBox.Model/Models/Goods/GoodsModels.cs
index fa590a3a..ab0ebfdc 100644
--- a/server/HoneyBox/src/HoneyBox.Model/Models/Goods/GoodsModels.cs
+++ b/server/HoneyBox/src/HoneyBox.Model/Models/Goods/GoodsModels.cs
@@ -382,6 +382,9 @@ public class GoodsInfoDto
[JsonPropertyName("prize_num")]
public int PrizeNum { get; set; }
+
+ [JsonPropertyName("shou_zhe_price")]
+ public string ShouZhePrice { get; set; } = "0";
}
diff --git a/server/HoneyBox/src/HoneyBox.Model/Models/Order/OrderModels.cs b/server/HoneyBox/src/HoneyBox.Model/Models/Order/OrderModels.cs
index 456331fc..0b6027a8 100644
--- a/server/HoneyBox/src/HoneyBox.Model/Models/Order/OrderModels.cs
+++ b/server/HoneyBox/src/HoneyBox.Model/Models/Order/OrderModels.cs
@@ -286,34 +286,34 @@ public class OrderCalculationDto
public string Price { get; set; } = "0.00";
///
- /// 商品信息
+ /// 商品信息(兼容旧版字段名 goods)
///
- [JsonPropertyName("goods_info")]
- public GoodsInfoDto? GoodsInfo { get; set; }
+ [JsonPropertyName("goods")]
+ public GoodsInfoDto? Goods { get; set; }
///
- /// 商品扩展配置
+ /// 商品扩展配置(兼容旧版字段名 goods_extend)
///
- [JsonPropertyName("goodsExtend")]
+ [JsonPropertyName("goods_extend")]
public GoodsExtendDto? GoodsExtend { get; set; }
///
- /// 用户余额
+ /// 用户余额(兼容旧版字段名 money)
///
- [JsonPropertyName("user_money")]
- public string UserMoney { get; set; } = "0.00";
+ [JsonPropertyName("money")]
+ public string Money { get; set; } = "0.00";
///
- /// 用户积分
+ /// 用户积分(兼容旧版字段名 integral)
///
- [JsonPropertyName("user_integral")]
- public string UserIntegral { get; set; } = "0.00";
+ [JsonPropertyName("integral")]
+ public string Integral { get; set; } = "0.00";
///
- /// 用户哈尼券
+ /// 用户哈尼券(兼容旧版字段名 score)
///
- [JsonPropertyName("user_money2")]
- public string UserMoney2 { get; set; } = "0.00";
+ [JsonPropertyName("score")]
+ public decimal Score { get; set; } = 0;
///
/// 使用余额金额
@@ -322,22 +322,40 @@ public class OrderCalculationDto
public string UseMoney { get; set; } = "0.00";
///
- /// 使用积分金额
+ /// 使用积分(原始值,1:100比例)
///
[JsonPropertyName("use_integral")]
public string UseIntegral { get; set; } = "0.00";
///
- /// 使用哈尼券金额
+ /// 使用积分换算成金额
+ ///
+ [JsonPropertyName("use_integral_money")]
+ public string UseIntegralMoney { get; set; } = "0.00";
+
+ ///
+ /// 使用哈尼券(兼容旧版字段名 use_score)
+ ///
+ [JsonPropertyName("use_score")]
+ public decimal UseScore { get; set; } = 0;
+
+ ///
+ /// 使用哈尼券(保留兼容)
///
[JsonPropertyName("use_money2")]
- public string UseMoney2 { get; set; } = "0.00";
+ public decimal UseMoney2 { get; set; } = 0;
+
+ ///
+ /// 优惠券ID
+ ///
+ [JsonPropertyName("coupon_id")]
+ public int CouponId { get; set; } = 0;
///
/// 优惠券抵扣金额
///
- [JsonPropertyName("use_coupon")]
- public string UseCoupon { get; set; } = "0.00";
+ [JsonPropertyName("coupon_price")]
+ public string CouponPrice { get; set; } = "0.00";
///
/// 可用优惠券列表
@@ -345,6 +363,18 @@ public class OrderCalculationDto
[JsonPropertyName("available_coupons")]
public List? AvailableCoupons { get; set; }
+ ///
+ /// 每日优惠券限制
+ ///
+ [JsonPropertyName("daily_coupon_limit")]
+ public int DailyCouponLimit { get; set; } = 0;
+
+ ///
+ /// 是否首抽五折
+ ///
+ [JsonPropertyName("is_shou_zhe")]
+ public int IsShouZhe { get; set; } = 0;
+
///
/// 折扣比例
///