mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 19:03:27 +08:00
【优化】调整运费计算逻辑为异步处理。
This commit is contained in:
@@ -116,24 +116,24 @@ namespace CoreCms.Net.Services
|
||||
/// <param name="weight">重量,单位g</param>
|
||||
/// <param name="totalmoney">商品总价</param>
|
||||
/// <returns></returns>
|
||||
public decimal GetShipCost(int areaId = 0, decimal weight = 0, decimal totalmoney = 0)
|
||||
public async Task<decimal> 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
|
||||
/// <summary>
|
||||
/// 根据地区获取配送方式
|
||||
/// </summary>
|
||||
public CoreCmsShip GetShip(int areaId = 0)
|
||||
public async Task<CoreCmsShip> 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;
|
||||
|
||||
Reference in New Issue
Block a user