diff --git a/CoreCms.Net.IServices/Cart/ICoreCmsCartServices.cs b/CoreCms.Net.IServices/Cart/ICoreCmsCartServices.cs
index 0bcae6a7..03020622 100644
--- a/CoreCms.Net.IServices/Cart/ICoreCmsCartServices.cs
+++ b/CoreCms.Net.IServices/Cart/ICoreCmsCartServices.cs
@@ -99,7 +99,7 @@ namespace CoreCms.Net.IServices
/// 购物车信息
/// 收货地址id
///
- bool CartFreight(CartDto cartDto, int areaId);
+ Task CartFreight(CartDto cartDto, int areaId);
///
diff --git a/CoreCms.Net.IServices/Shop/ICoreCmsShipServices.cs b/CoreCms.Net.IServices/Shop/ICoreCmsShipServices.cs
index ae53be69..a273303a 100644
--- a/CoreCms.Net.IServices/Shop/ICoreCmsShipServices.cs
+++ b/CoreCms.Net.IServices/Shop/ICoreCmsShipServices.cs
@@ -59,7 +59,7 @@ namespace CoreCms.Net.IServices
/// 重量,单位g
/// 商品总价
///
- decimal GetShipCost(int areaId = 0, decimal weight = 0, decimal totalmoney = 0);
+ Task GetShipCost(int areaId = 0, decimal weight = 0, decimal totalmoney = 0);
///
@@ -75,7 +75,7 @@ namespace CoreCms.Net.IServices
///
/// 根据地区获取配送方式
///
- CoreCmsShip GetShip(int areaId = 0);
+ Task GetShip(int areaId = 0);
#region 重写增删改查操作===========================================================
diff --git a/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs b/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs
index 32872763..d01ad429 100644
--- a/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs
+++ b/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs
@@ -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 算运费
+
///
/// 算运费
///
/// 购物车信息
/// 收货地址id
///
- public bool CartFreight(CartDto cartDto, int areaId)
+ public async Task 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;
diff --git a/CoreCms.Net.Services/Order/CoreCmsOrderServices.cs b/CoreCms.Net.Services/Order/CoreCmsOrderServices.cs
index 32d5569d..0360ac87 100644
--- a/CoreCms.Net.Services/Order/CoreCmsOrderServices.cs
+++ b/CoreCms.Net.Services/Order/CoreCmsOrderServices.cs
@@ -583,7 +583,7 @@ namespace CoreCms.Net.Services
order.shipName = userShipInfo.name;
order.shipMobile = userShipInfo.mobile;
- var ship = _shipServices.GetShip(userShipInfo.areaId);
+ var ship = await _shipServices.GetShip(userShipInfo.areaId);
if (ship != null)
{
order.logisticsId = ship.id;
diff --git a/CoreCms.Net.Services/Shop/CoreCmsShipServices.cs b/CoreCms.Net.Services/Shop/CoreCmsShipServices.cs
index 8604f67c..47bc27ba 100644
--- a/CoreCms.Net.Services/Shop/CoreCmsShipServices.cs
+++ b/CoreCms.Net.Services/Shop/CoreCmsShipServices.cs
@@ -116,24 +116,24 @@ namespace CoreCms.Net.Services
/// 重量,单位g
/// 商品总价
///
- public decimal GetShipCost(int areaId = 0, decimal weight = 0, decimal totalmoney = 0)
+ public async Task GetShipCost(int areaId = 0, decimal weight = 0, decimal totalmoney = 0)
{
decimal postfee = 0;
var idStr = areaId.ToString();
//先判断是否子地区满足条件
- var def = base.QueryByClause(p =>
- p.status == (int)GlobalEnumVars.ShipStatus.Yes &&
- p.areaType == (int)GlobalEnumVars.ShipAreaType.Part && p.areaFee.Contains(idStr));
+ var def = await _dal.QueryByClauseAsync(p =>
+ p.status == (int)GlobalEnumVars.ShipStatus.Yes &&
+ p.areaType == (int)GlobalEnumVars.ShipAreaType.Part && p.areaFee.Contains(idStr));
//没有子地区取默认
if (def == null)
{
- def = base.QueryByClause(p => p.isDefault == true && p.status == (int)GlobalEnumVars.ShipStatus.Yes);
+ def = await _dal.QueryByClauseAsync(p => p.isDefault == true && p.status == (int)GlobalEnumVars.ShipStatus.Yes);
}
//没有默认取启用状态
if (def == null)
{
- def = base.QueryByClause(p => p.status == (int)GlobalEnumVars.ShipStatus.Yes);
+ def = await _dal.QueryByClauseAsync(p => p.status == (int)GlobalEnumVars.ShipStatus.Yes);
if (def == null)
{//没有配送方式,返回0
return postfee;
@@ -226,22 +226,22 @@ namespace CoreCms.Net.Services
///
/// 根据地区获取配送方式
///
- public CoreCmsShip GetShip(int areaId = 0)
+ public async Task GetShip(int areaId = 0)
{
var idStr = areaId.ToString();
//先判断是否子地区满足条件
- var def = base.QueryByClause(p =>
+ var def = await _dal.QueryByClauseAsync(p =>
p.status == (int)GlobalEnumVars.ShipStatus.Yes &&
p.areaType == (int)GlobalEnumVars.ShipAreaType.Part && p.areaFee.Contains(idStr));
//没有子地区取默认
if (def == null)
{
- def = base.QueryByClause(p => p.isDefault == true && p.status == (int)GlobalEnumVars.ShipStatus.Yes);
+ def = await _dal.QueryByClauseAsync(p => p.isDefault == true && p.status == (int)GlobalEnumVars.ShipStatus.Yes);
}
//没有默认取启用状态
if (def == null)
{
- def = base.QueryByClause(p => p.status == (int)GlobalEnumVars.ShipStatus.Yes);
+ def = await _dal.QueryByClauseAsync(p => p.status == (int)GlobalEnumVars.ShipStatus.Yes);
return def;
}
return def;