【优化】调整运费计算逻辑为异步处理。

This commit is contained in:
jianweie code
2023-04-03 02:30:16 +08:00
parent a87569c36d
commit 8b7377de63
5 changed files with 19 additions and 17 deletions

View File

@@ -600,7 +600,8 @@ namespace CoreCms.Net.Services
else if (deliveryType == (int)GlobalEnumVars.OrderReceiptType.Logistics)
{
// 运费判断
if (CartFreight(cartDto, areaId) == false)
var blFreight = await CartFreight(cartDto, areaId);
if (blFreight == false)
{
jm.data = cartDto;
jm.msg = "运费判断";
@@ -665,17 +666,18 @@ namespace CoreCms.Net.Services
#endregion
#region
/// <summary>
/// 算运费
/// </summary>
/// <param name="cartDto">购物车信息</param>
/// <param name="areaId">收货地址id</param>
/// <returns></returns>
public bool CartFreight(CartDto cartDto, int areaId)
public async Task<bool> CartFreight(CartDto cartDto, int areaId)
{
if (areaId > 0)
{
cartDto.costFreight = _shipServices.GetShipCost(areaId, cartDto.weight, cartDto.goodsAmount);
cartDto.costFreight =await _shipServices.GetShipCost(areaId, cartDto.weight, cartDto.goodsAmount);
cartDto.amount = Math.Round(cartDto.amount + cartDto.costFreight, 2);
}
return true;