Commit ad128854 authored by 吴春's avatar 吴春

自动发放优惠券

parent 8cf6d0b2
......@@ -896,12 +896,12 @@ namespace Mall.Module.MarketingCenter
}
//根据发放类型获取对应的优惠券信息
var couponList = discountCouponRepository.GetSelfmotionCouponList(model);
if (couponList != null && couponList.Any(x => x.TotalNum == -1 || ((x.TotalNum - x.ReceiveNum) > 0)))//存在满足条件的优惠券可以发放
if (couponList != null && couponList.Any(x => x.TotalNum == -1 || x.TotalNum > 0))//存在满足条件的优惠券可以发放
{
bool isReceive = false;
//查询已发放的优惠券信息
var memberCouponList = memberCouponRepository.GetAutoMemberCouponPageList(new RB_Member_DiscountCoupon_Extend { UserId = model.UserId, GetType = model.TriggerType, TenantId = model.TenantId, MallBaseId = model.MallBaseId });
foreach (var item in couponList.Where(x => x.TotalNum == -1 || ((x.TotalNum - x.ReceiveNum) > 0)))//判断当前优惠券是否已超过领取数
foreach (var item in couponList.Where(x => x.TotalNum == -1 || x.TotalNum > 0))//判断当前优惠券是否已超过领取数
{
int membercouponCoun = memberCouponList.Where(x => x.CouponId == item.ID).Count();
if (!isReceive && membercouponCoun < item.GrantNum)//此次没有领取,并且当前优惠券没有超过领取数量
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment