Exemplo n.º 1
0
        ///// <summary>
        ///// 分享推广 购彩 送红包
        ///// </summary>
        ///// <param name="userId"></param>
        //public void FirstLotteryGiveRedBag(string userId)
        //{
        //    using (var biz = new GameBizBusinessManagement())
        //    {
        //        biz.BeginTran();
        //        //分享推广 购彩 送红包
        //        //购彩了 且是通过分享注册的用户 没有送红包 就执行分享推广活动
        //        var entityBankCard = new BankCardManager().BankCardById(userId);
        //        var entityShareSpread = new BlogManager().QueryBlog_UserShareSpread(userId);
        //        if (entityBankCard != null && entityShareSpread != null && !entityShareSpread.isGiveLotteryRedBag)
        //        {
        //            //购彩了 没有给分享者送活动红包 就执行送红包 只送一次
        //            var giveFillMoney = decimal.Parse(Activity.Business.ActivityCache.QueryActivityConfig("ActivityConfig.FirstLotteryGiveRedBagTofxid").ConfigValue);
        //            if (giveFillMoney > 0)
        //            {
        //                BusinessHelper.Payin_To_Balance(AccountType.RedBag, BusinessHelper.FundCategory_Activity, entityShareSpread.AgentId, Guid.NewGuid().ToString("N"), giveFillMoney
        //                                  , string.Format("{1}用户购彩了赠送红包给分享推广用户{0}元", giveFillMoney, userId), RedBagCategory.FxidRegister);

        //                entityShareSpread.isGiveLotteryRedBag = true;
        //                entityShareSpread.UpdateTime = DateTime.Now;
        //                entityShareSpread.giveRedBagMoney = entityShareSpread.giveRedBagMoney + giveFillMoney;
        //                new BlogManager().UpdateBlog_UserShareSpread(entityShareSpread);
        //            }
        //        }
        //        biz.CommitTran();
        //    }
        //}

        /// <summary>
        /// 分享推广 购彩 送红包(满x元送z元红包)
        /// </summary>
        /// <param name="userId"></param>
        public void FirstLotteryGiveRedBag(string userId, decimal totalMoney)
        {
            try
            {
                DB.Begin();
                //分享推广 购彩 送红包
                //购彩了 且是通过分享注册的用户 没有送红包 就执行分享推广活动
                //var entityBankCard = new BankCardManager().BankCardById(userId);
                /*entityBankCard != null */
                var entityShareSpread = new BlogManager().QueryBlog_UserShareSpread(userId);

                var satisfyFillMoney = decimal.Parse(ActivityCache.QueryActivityConfig("ActivityConfig.SatisfyLotteryGiveRedBagTofxid"));
                if (entityShareSpread != null && !entityShareSpread.isGiveLotteryRedBag && totalMoney >= satisfyFillMoney)
                {
                    //购彩了 没有给分享者送活动红包 就执行送红包 只送一次
                    var giveFillMoney = decimal.Parse(ActivityCache.QueryActivityConfig("ActivityConfig.FirstLotteryGiveRedBagTofxid"));
                    if (giveFillMoney > 0)
                    {
                        BusinessHelper.Payin_To_Balance(AccountType.RedBag, BusinessHelper.FundCategory_Activity, entityShareSpread.AgentId, Guid.NewGuid().ToString("N"), giveFillMoney
                                                        , string.Format("{1}用户购彩超过{2}元,赠送红包给分享推广用户{0}元", giveFillMoney, userId, satisfyFillMoney), RedBagCategory.FxidRegister);

                        entityShareSpread.isGiveLotteryRedBag = true;
                        entityShareSpread.UpdateTime          = DateTime.Now;
                        entityShareSpread.giveRedBagMoney     = entityShareSpread.giveRedBagMoney + giveFillMoney;
                        new BlogManager().UpdateBlog_UserShareSpread(entityShareSpread);
                    }
                }
                DB.Commit();
            }
            catch (Exception ex)
            {
                DB.Rollback();
                throw ex;
            }
        }
Exemplo n.º 2
0
 public void FirstOrderShareRegisterRedBag(string schemeId)
 {
     try
     {
         DB.Begin();
         var schemeInfo = new OrderQuery().QuerySportsSchemeInfo(schemeId);
         if (schemeInfo != null && schemeInfo.BonusStatus != BonusStatus.Win || schemeInfo.PreTaxBonusMoney == 0)
         {
             return;
         }
         //分享推广 购彩 送红包
         //购彩了 且是通过分享注册的用户 没有送红包 就执行分享推广活动
         //var entityBankCard = new BankCardManager().BankCardById(userId);
         //var entityShareSpread = new BlogManager().QueryBlog_UserShareSpread(userId);
         //if (entityBankCard != null && entityShareSpread != null && !entityShareSpread.isGiveLotteryRedBag)
         //{
         //购彩了 没有给分享者送活动红包 就执行送红包 只送一次
         var shareGiveRedBagPre = decimal.Parse(ActivityCache.QueryActivityConfig("ActivityConfig.WinningShareGiveRedBag"));
         var business           = new BlogManager();
         var oldmodel           = business.QueryBlog_OrderShareRegisterRedBag(schemeId, schemeInfo.UserId);
         if (oldmodel != null)
         {
             if (!oldmodel.IsGiveRegisterRedBag && shareGiveRedBagPre > 0)
             {
                 var giveFillMoney = schemeInfo.PreTaxBonusMoney * shareGiveRedBagPre / 100;
                 BusinessHelper.Payin_To_Balance(AccountType.RedBag, BusinessHelper.FundCategory_Activity, schemeInfo.UserId, Guid.NewGuid().ToString("N"), giveFillMoney
                                                 , string.Format("分享中奖订单{0},加奖红包:{1}元", schemeId, giveFillMoney.ToString("f2")), RedBagCategory.OrderRegister);
                 oldmodel.IsGiveRegisterRedBag = true;
             }
             //更新条数
             oldmodel.RegisterCount += 1;
             oldmodel.UpdateTime     = DateTime.Now;
             business.UpdateBlog_OrderShareRegisterRedBag(oldmodel);
         }
         else
         {
             var flag          = false;
             var giveFillMoney = 0m;
             if (shareGiveRedBagPre > 0)
             {
                 //发奖
                 giveFillMoney = schemeInfo.PreTaxBonusMoney * shareGiveRedBagPre / 100;
                 BusinessHelper.Payin_To_Balance(AccountType.RedBag, BusinessHelper.FundCategory_Activity, schemeInfo.UserId, Guid.NewGuid().ToString("N"), giveFillMoney
                                                 , string.Format("分享中奖订单{0},加奖红包:{1}元", schemeId, giveFillMoney), RedBagCategory.OrderRegister);
                 flag = true;
             }
             //插入数据库
             var newmodel = new E_Blog_OrderShareRegisterRedBag()
             {
                 CreateTime           = DateTime.Now,
                 IsGiveRegisterRedBag = flag,
                 RedBagMoney          = giveFillMoney,
                 RedBagPre            = shareGiveRedBagPre,
                 UpdateTime           = DateTime.Now,
                 RegisterCount        = 1,
                 SchemeId             = schemeId,
                 UserId = schemeInfo.UserId
             };
             business.Add_OrderShareRegisterRedBag(newmodel);
         }
         DB.Commit();
     }
     catch (Exception ex)
     {
         DB.Rollback();
         throw ex;
     }
 }
Exemplo n.º 3
0
        public bool User_AfterLogin(string userId, string loginFrom, string loginIp, DateTime loginTime)
        {
            if (string.IsNullOrEmpty(userId))
            {
                return(false);
            }
            var date = DateTime.Today.ToString("yyyyMMdd");
            //注册当前登录不送红包
            var user = new UserBalanceManager().QueryUserRegister(userId);

            if (user.CreateTime.ToString("yyyyMMdd") == date)
            {
                return(false);
            }


            var bizRealName = new RealNameAuthenticationBusiness();
            var realName    = bizRealName.GetAuthenticatedRealName(userId);

            if (realName == null)
            {
                return(false);
            }
            var bizMoible = new MobileAuthenticationBusiness();
            var mobile    = bizMoible.GetAuthenticatedMobile(userId);

            if (mobile == null || !mobile.IsSettedMobile)
            {
                return(false);
            }

            var manager = new A20150919Manager();
            var record  = manager.QueryA20150919_已绑定身份和手机的用户登录送红包(userId, date);

            if (record != null)
            {
                return(false);
            }

            //var old = manager.QueryByUserId(userId);
            //if (old == null) return;
            //if (!old.IsBindRealName) return;
            //if (!old.IsBindMobile) return;

            decimal giveMoney = decimal.Parse(ActivityCache.QueryActivityConfig("ActivityConfig.BindedUserLoginGiveRedBag"));

            if (user.VipLevel >= 0)
            {
                var config = ActivityCache.QueryActivityConfig(string.Format("ActivityConfig.BindedUserLoginGiveRedBagV{0}", user.VipLevel));
                if (config != null)
                {
                    try
                    {
                        giveMoney = decimal.Parse(config);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            if (giveMoney > 0)
            {
                BusinessHelper.Payin_To_Balance(AccountType.RedBag, BusinessHelper.FundCategory_Activity, userId, Guid.NewGuid().ToString("N"), giveMoney
                                                , string.Format("绑定身份和手机后,VIP{1} 每天登录赠送红包{0}元", giveMoney, user.VipLevel), RedBagCategory.Activity);
                manager.AddA20150919_已绑定身份和手机的用户登录送红包(new E_A20150919_已绑定身份和手机的用户登录送红包
                {
                    CreateTime      = DateTime.Now,
                    UserId          = userId,
                    LoginDate       = date,
                    GiveRedBagMoney = giveMoney,
                });
                return(true);
            }
            return(false);
        }