mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 19:43:26 +08:00
【修复】修复使用积分,优惠券,全局营销并行多优惠的条件叠加的情况下,可能存在下单金额低于0元的问题。
This commit is contained in:
@@ -670,6 +670,12 @@ namespace CoreCms.Net.Services
|
||||
return jm;
|
||||
}
|
||||
|
||||
//判断最终价格
|
||||
if (cartDto.amount < 0)
|
||||
{
|
||||
cartDto.amount = 0;
|
||||
}
|
||||
|
||||
jm.status = true;
|
||||
jm.data = cartDto;
|
||||
jm.msg = "4";
|
||||
|
||||
@@ -296,7 +296,7 @@ namespace CoreCms.Net.Services
|
||||
{
|
||||
var res = _goodsServices.ChangeStock(item.productId,
|
||||
GlobalEnumVars.OrderChangeStockType.order.ToString(), item.nums);
|
||||
if (res.status == false)
|
||||
if (!res.status)
|
||||
{
|
||||
jm.msg += $"{item.name}库存不足";
|
||||
}
|
||||
@@ -326,7 +326,7 @@ namespace CoreCms.Net.Services
|
||||
jm.msg = "订单明细更新" + avaliableOrderItems.Count;
|
||||
var outItems = await _orderItemServices.InsertCommandAsync(avaliableOrderItems);
|
||||
var outItemsBool = outItems > 0;
|
||||
if (outItemsBool == false)
|
||||
if (!outItemsBool)
|
||||
{
|
||||
_unitOfWork.RollbackTran();
|
||||
jm.msg = "订单明细更新失败";
|
||||
@@ -339,7 +339,7 @@ namespace CoreCms.Net.Services
|
||||
{
|
||||
var arr = CommonHelper.StringToStringArray(couponCode);
|
||||
var couponRes = await _couponServices.UsedMultipleCoupon(arr, order.orderId);
|
||||
if (couponRes.status == false)
|
||||
if (!couponRes.status)
|
||||
{
|
||||
_unitOfWork.RollbackTran();
|
||||
return couponRes;
|
||||
@@ -352,7 +352,7 @@ namespace CoreCms.Net.Services
|
||||
jm.msg += "积分核销";
|
||||
var pointLogRes = await _userPointLogServices.SetPoint(userId, 0 - order.point,
|
||||
(int)GlobalEnumVars.UserPointSourceTypes.PointTypeDiscount, "订单" + order.orderId + "使用");
|
||||
if (pointLogRes.status == false)
|
||||
if (!pointLogRes.status)
|
||||
{
|
||||
_unitOfWork.RollbackTran();
|
||||
return pointLogRes;
|
||||
@@ -368,7 +368,7 @@ namespace CoreCms.Net.Services
|
||||
case (int)GlobalEnumVars.OrderType.PinTuan:
|
||||
//拼团模式去校验拼团是否存在,并添加拼团记录
|
||||
var pinTuanRes = await _pinTuanRecordServices.OrderAdd(order, avaliableOrderItems, teamId);
|
||||
if (pinTuanRes.status == false)
|
||||
if (!pinTuanRes.status)
|
||||
{
|
||||
_unitOfWork.RollbackTran();
|
||||
return pinTuanRes;
|
||||
@@ -379,7 +379,7 @@ namespace CoreCms.Net.Services
|
||||
var groupRes =
|
||||
await _promotionRecordServices.OrderAdd(order, avaliableOrderItems, objectId,
|
||||
orderType);
|
||||
if (groupRes.status == false)
|
||||
if (!groupRes.status)
|
||||
{
|
||||
_unitOfWork.RollbackTran();
|
||||
return groupRes;
|
||||
@@ -390,7 +390,7 @@ namespace CoreCms.Net.Services
|
||||
var seckillRes =
|
||||
await _promotionRecordServices.OrderAdd(order, avaliableOrderItems, objectId,
|
||||
orderType);
|
||||
if (seckillRes.status == false)
|
||||
if (!seckillRes.status)
|
||||
{
|
||||
_unitOfWork.RollbackTran();
|
||||
return seckillRes;
|
||||
@@ -422,21 +422,6 @@ namespace CoreCms.Net.Services
|
||||
};
|
||||
await _orderLogServices.InsertAsync(orderLog);
|
||||
|
||||
//0元订单记录支付成功
|
||||
if (order.orderAmount <= 0)
|
||||
{
|
||||
orderLog = new CoreCmsOrderLog
|
||||
{
|
||||
userId = userId,
|
||||
orderId = order.orderId,
|
||||
type = (int)GlobalEnumVars.OrderLogTypes.LOG_TYPE_PAY,
|
||||
msg = "0元订单直接支付成功",
|
||||
data = JsonConvert.SerializeObject(order),
|
||||
createTime = DateTime.Now
|
||||
};
|
||||
await _orderLogServices.InsertAsync(orderLog);
|
||||
}
|
||||
|
||||
//企业发票信息记录
|
||||
if (taxType == (int)GlobalEnumVars.OrderTaxType.Company)
|
||||
{
|
||||
@@ -459,6 +444,61 @@ namespace CoreCms.Net.Services
|
||||
//0元订单记录支付成功
|
||||
if (order.orderAmount <= 0)
|
||||
{
|
||||
//创建支付单
|
||||
var billPayments = new CoreCmsBillPayments();
|
||||
billPayments.paymentId = CommonHelper.GetSerialNumberType((int)GlobalEnumVars.SerialNumberType.支付单编号);
|
||||
billPayments.sourceId = order.orderId;
|
||||
billPayments.money = 0;
|
||||
billPayments.userId = userId;
|
||||
billPayments.type = order.orderType;
|
||||
billPayments.status = (int)GlobalEnumVars.BillPaymentsStatus.Payed;
|
||||
billPayments.paymentCode = GlobalEnumVars.PaymentsTypes.balancepay.ToString();
|
||||
billPayments.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "127.0.0.1";
|
||||
billPayments.payedMsg = "0元订单直接支付成功";
|
||||
billPayments.parameters = "";
|
||||
billPayments.createTime = DateTime.Now;
|
||||
billPayments.updateTime = DateTime.Now;
|
||||
|
||||
|
||||
await _billPaymentsServices.InsertAsync(billPayments);
|
||||
|
||||
//调整直接支付成功
|
||||
await _dal.UpdateAsync(p => new CoreCmsOrder()
|
||||
{
|
||||
payedAmount = 0,
|
||||
paymentTime = DateTime.Now,
|
||||
updateTime = DateTime.Now,
|
||||
paymentCode = GlobalEnumVars.PaymentsTypes.balancepay.ToString(),
|
||||
payStatus = (int)GlobalEnumVars.OrderPayStatus.Yes,
|
||||
orderAmount = 0
|
||||
}, p => p.orderId == order.orderId);
|
||||
|
||||
//记录订单日志
|
||||
orderLog = new CoreCmsOrderLog
|
||||
{
|
||||
userId = userId,
|
||||
orderId = order.orderId,
|
||||
type = (int)GlobalEnumVars.OrderLogTypes.LOG_TYPE_PAY,
|
||||
msg = "0元订单直接支付成功",
|
||||
data = JsonConvert.SerializeObject(order),
|
||||
createTime = DateTime.Now
|
||||
};
|
||||
await _orderLogServices.InsertAsync(orderLog);
|
||||
|
||||
//如果是门店自提,应该自动跳过发货,生成提货单信息,使用提货单核销。
|
||||
if (order.receiptType == (int)GlobalEnumVars.OrderReceiptType.SelfDelivery)
|
||||
{
|
||||
var allConfigs = await _settingServices.GetConfigDictionaries();
|
||||
var storeOrderAutomaticDelivery = CommonHelper
|
||||
.GetConfigDictionary(allConfigs, SystemSettingConstVars.StoreOrderAutomaticDelivery)
|
||||
.ObjectToInt(1);
|
||||
if (storeOrderAutomaticDelivery == 1)
|
||||
{
|
||||
//订单自动发货
|
||||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.OrderAutomaticDelivery, JsonConvert.SerializeObject(order));
|
||||
}
|
||||
}
|
||||
|
||||
//用户升级处理
|
||||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.UserUpGrade, JsonConvert.SerializeObject(order));
|
||||
//发送支付成功信息,增加发送内容
|
||||
|
||||
Reference in New Issue
Block a user