public static IEnumerable <Entities.BonusInfo> GetBonusByType(Mall.Entities.BonusInfo.BonusType bonusType) { return(BonusApplication.GetBonusByType(bonusType)); }
public static string GetBonusSurplus(long bonusId) { return(BonusApplication.GetBonusSurplus(bonusId)); }
public static void WinnerSubmit(WeiActivityWinModel winModel) { Entities.WeiActivityInfoInfo model = _iActivityInfoService.GetActivityModel(winModel.activityId); //添加中奖信息记录 Entities.WeiActivityWinInfoInfo activityWinInfo = new Entities.WeiActivityWinInfoInfo(); activityWinInfo.ActivityId = winModel.activityId; activityWinInfo.AddDate = DateTime.Now; activityWinInfo.UserId = winModel.userId; activityWinInfo.IsWin = winModel.isWin; //消耗积分 if (winModel.integrals > 0) { var factoryService = ServiceProvider.Instance <IMemberIntegralConversionFactoryService> .Create; Mall.Entities.MemberIntegralRecordInfo info = new Mall.Entities.MemberIntegralRecordInfo(); info.UserName = MemberApplication.GetMember(activityWinInfo.UserId).UserName; info.MemberId = activityWinInfo.UserId; info.RecordDate = DateTime.Now; info.ReMark = ((WeiActivityType)model.ActivityType).ToDescription() + "消耗"; info.TypeId = Entities.MemberIntegralInfo.IntegralType.WeiActivity; var memberIntegral = factoryService.Create(Mall.Entities.MemberIntegralInfo.IntegralType.WeiActivity, -winModel.integrals); MemberIntegralApplication.AddMemberIntegral(info, memberIntegral); } if (activityWinInfo.IsWin) { if (winModel.awardType == WeiActivityAwardType.Integral)//积分 { activityWinInfo.AwardName = winModel.awardName + " 积分"; //新增积分记录 var factoryService = ServiceProvider.Instance <IMemberIntegralConversionFactoryService> .Create; Entities.MemberIntegralRecordInfo info = new Entities.MemberIntegralRecordInfo(); info.UserName = MemberApplication.GetMember(activityWinInfo.UserId).UserName; info.MemberId = activityWinInfo.UserId; info.RecordDate = DateTime.Now; info.ReMark = ((WeiActivityType)model.ActivityType).ToDescription() + "中奖"; info.TypeId = Mall.Entities.MemberIntegralInfo.IntegralType.WeiActivity; var memberIntegral = factoryService.Create(Entities.MemberIntegralInfo.IntegralType.WeiActivity, Convert.ToInt32(winModel.awardName));//winModel.integrals为消耗积分 此处不是用户总积分 MemberIntegralApplication.AddMemberIntegral(info, memberIntegral); } else if (winModel.awardType == WeiActivityAwardType.Bonus)//红包 { activityWinInfo.AwardName = winModel.awardName; BonusApplication.SetShareByUserId(winModel.bonusId, false, winModel.userId);//添加红包记录 BonusApplication.IncrReceiveCount(winModel.bonusId); } else { activityWinInfo.AwardName = winModel.awardName; //添加优惠券记录 Entities.CouponRecordInfo recordInfo = new Entities.CouponRecordInfo(); recordInfo.UserId = winModel.userId; recordInfo.UserName = MemberApplication.GetMember(winModel.userId).UserName; recordInfo.ShopId = CouponApplication.GetCouponInfo(winModel.couponId).ShopId; recordInfo.CouponId = winModel.couponId; CouponApplication.AddCouponRecord(recordInfo); } } else { activityWinInfo.AwardName = winModel.awardName; } activityWinInfo.AwardId = winModel.awardId; _iWeiActivityWinService.AddWinner(activityWinInfo); }