【修复】修复秒杀和团购的后台配置了个人限购数量,但是没有生效,前端还是可以购买超过限购数量的商品的问题。

This commit is contained in:
jianweie
2023-05-06 16:58:55 +08:00
parent 66e52c5376
commit 238e26a5cf

View File

@@ -246,7 +246,7 @@ namespace CoreCms.Net.Services
await _dal.DeleteAsync(p => typeIds.Contains(p.type) && p.productId == products.id && p.userId == userId);
catInfo = null;
var checkOrder = orderServices.FindLimitOrder(products.id, userId, promotionsModel.startTime, promotionsModel.endTime, cartTypes);
var checkOrder = orderServices.FindLimitOrderByGoodId(products.goodsId, userId, promotionsModel.startTime, promotionsModel.endTime, cartTypes);
if (promotionsModel.maxGoodsNums > 0)
{
if (checkOrder.TotalOrders + nums > promotionsModel.maxGoodsNums)
@@ -258,9 +258,9 @@ namespace CoreCms.Net.Services
}
if (promotionsModel.maxNums > 0)
{
if (checkOrder.TotalUserOrders > promotionsModel.maxNums)
if (checkOrder.TotalUserOrders + nums > promotionsModel.maxNums)
{
jm.data = 15611;
jm.data = 15611;;
jm.msg = GlobalErrorCodeVars.Code15611;
return jm;
}
@@ -677,7 +677,7 @@ namespace CoreCms.Net.Services
{
if (areaId > 0)
{
cartDto.costFreight =await _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;
@@ -736,7 +736,7 @@ namespace CoreCms.Net.Services
else if (result is > 15 and <= 20)
cartDto.costFreight = intraCityServiceBy20Km;
else if (result > 20)
cartDto.costFreight = Math.Round(intraCityServiceByExceed20Km * (decimal) result).ObjectToDecimal();
cartDto.costFreight = Math.Round(intraCityServiceByExceed20Km * (decimal)result).ObjectToDecimal();
else if (result < 0)
cartDto.costFreight = intraCityServiceBy2Km;
else