【新增】增加售后审核通过后,积分返还机制的队列实现,取消原有积分统一返还机制。

This commit is contained in:
大灰灰
2022-08-12 01:57:18 +08:00
parent e34dff3f64
commit be6fa211be
7 changed files with 182 additions and 13 deletions

View File

@@ -144,6 +144,7 @@ namespace CoreCms.Net.Services
#endregion
#region ============================================
/// <summary>
/// 统计用户的售后数量
/// </summary>
@@ -376,10 +377,19 @@ namespace CoreCms.Net.Services
{
if (type == (int)GlobalEnumVars.BillAftersalesIsReceive.Refund)
{
var n = orderItem.nums - orderItem.sendNums - (orderItem.reshipNums - orderItem.reshipedNums);
if (n < nums)
//售后中未退换的数量(申请售后退还的,已经收到退还的,差额就是客户还需要退还的)
var reshipNum = orderItem.reshipNums - orderItem.reshipedNums;
//如果未发货但申请售后大于0
if (orderItem.sendNums == 0 && nums > 0)
{
jm.msg = orderItem.name + orderItem.addon + ",未发货商品,最多能退" + n + "个";
jm.msg = orderItem.name + orderItem.addon + ",未发货商品,退货数量只能为0个";
return jm;
}
//如果当前售后数量+未寄送的售后数量 > 已经发货数量
if (reshipNum + nums > orderItem.sendNums)
{
jm.msg = orderItem.name + orderItem.addon + ",售后申请超过数量,最多能退" + (orderItem.sendNums - reshipNum - nums) + "个";
return jm;
}
}
@@ -625,17 +635,16 @@ namespace CoreCms.Net.Services
orderInfo.payStatus = (int)GlobalEnumVars.OrderPayStatus.Refunded;
orderInfo.status = (int)GlobalEnumVars.OrderStatus.Complete;
//返还积分
if (orderInfo.point > 0)
{
await _userPointLogServices.SetPoint(orderInfo.userId, orderInfo.point, (int)GlobalEnumVars.UserPointSourceTypes.PointRefundReturn, "售后退款:" + orderInfo.orderId + "返还积分");
}
//返还积分(此模式会导致多次售后刷积分情况)
//if (orderInfo.point > 0)
//{
// await _userPointLogServices.SetPoint(orderInfo.userId, orderInfo.point, (int)GlobalEnumVars.UserPointSourceTypes.PointRefundReturn, "售后退款:" + orderInfo.orderId + "返还积分");
//}
//返还优惠券
if (!string.IsNullOrEmpty(orderInfo.coupon))
{
await couponServices.CancelReturnCoupon(orderInfo.coupon);
}
}
else
{
@@ -731,6 +740,8 @@ namespace CoreCms.Net.Services
{
//售后审核通过后处理
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.AfterSalesReview, aftersalesId);
//售后审核通过后积分退还机制
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.AfterSalesReviewForPoint, aftersalesId);
}
}