示例#1
0
        /// <summary>
        /// 恢复代理
        /// </summary>
        public void RecoveryAgent(string userId)
        {
            //开启事务
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();

                var manager  = new UserBalanceManager();
                var register = manager.LoadUserRegister(userId);
                if (register == null)
                {
                    throw new Exception("用户不存在");
                }
                var agent = new OCAgentManager().QueryOCAgent(userId);
                if (agent == null)
                {
                    throw new Exception("代理关系不存在");
                }

                register.IsAgent = true;
                manager.UpdateUserRegister(register);

                biz.CommitTran();
            }
        }
示例#2
0
        /// <summary>
        /// 每购彩100元增加成长值
        /// </summary>
        public void ComplateTicket(string userId, string schemeId, decimal totalMoney, decimal totalErrorMoney)
        {
            DB.Begin();
            try
            {
                var manager     = new SchemeManager();
                var orderDetail = manager.QueryOrderDetail(schemeId);
                if (orderDetail == null || orderDetail.SchemeType == (int)SchemeType.SaveScheme || orderDetail.SchemeType == (int)SchemeType.SingleTreasure || orderDetail.IsVirtualOrder)
                {
                    return;
                }

                //查询用户信息
                var userManager = new UserBalanceManager();
                var user        = userManager.LoadUserRegister(orderDetail.UserId);
                //赠送成长值
                var growthValue = GrowthValue(user.VipLevel, totalMoney);

                var currGrowth = manager.GetCurrDayGiveGrowth(userId);
                if (currGrowth >= 100)//每天赠送的成长值不能大于100
                {
                    return;
                }
                var sumGrowth = growthValue + currGrowth;
                if (sumGrowth > 100)
                {
                    growthValue = 100 - currGrowth;
                }

                if (growthValue > 0M)
                {
                    BusinessHelper.Payin_UserGrowth(BusinessHelper.FundCategory_BuyGrowthValue, schemeId, user.UserId, (int)Math.Round(growthValue), string.Format("购彩赠送成长值:{0}", (int)Math.Round(growthValue)));
                }

                //赠送豆豆
                var doudou = GetDoudou(user.VipLevel, totalMoney);
                if (doudou > 0M)
                {
                    BusinessHelper.Payin_OCDouDou(BusinessHelper.FundCategory_BuyDouDou, schemeId, user.UserId, (int)Math.Round(doudou), string.Format("购彩赠送豆豆:{0}", (int)Math.Round(doudou)));
                }

                DB.Commit();
            }
            catch (Exception ex)
            {
                DB.Rollback();
                throw ex;
            }
        }
示例#3
0
        /// <summary>
        /// 禁用用户
        /// </summary>
        public void DisableUser(string userId)
        {
            //开启事务
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();

                var manager  = new UserBalanceManager();
                var register = manager.LoadUserRegister(userId);
                if (register == null)
                {
                    throw new Exception("用户不存在");
                }
                register.IsEnable = false;
                manager.UpdateUserRegister(register);

                biz.CommitTran();
            }
        }
示例#4
0
        public void BatchSetInnerUser(string userIds)
        {
            if (string.IsNullOrEmpty(userIds))
            {
                throw new Exception("用户编号不能为空");
            }
            var arrUserIds = userIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);

            using (var biz = new GameBizAuthBusinessManagement())
            {
                var manager = new UserBalanceManager();
                biz.BeginTran();
                foreach (var item in arrUserIds)
                {
                    var entity = manager.LoadUserRegister(item);
                    entity.UserType = 1;
                    manager.UpdateUserRegister(entity);
                }
                biz.CommitTran();
            }
        }
示例#5
0
        /// <summary>
        /// 保存用户未投注订单
        /// </summary>
        public string SaveOrderSportsBetting(Sports_BetingInfo info, string userId)
        {
            string schemeId = string.Empty;

            info.GameCode = info.GameCode.ToUpper();
            info.GameType = info.GameType.ToUpper();
            var gameCode = info.GameCode;

            schemeId = BettingHelper.GetSportsBettingSchemeId(gameCode);
            var sportsManager = new Sports_Manager();
            //验证比赛是否还可以投注
            var stopTime = CheckGeneralBettingMatch(sportsManager, gameCode, info.GameType, info.PlayType, info.AnteCodeList, info.IssuseNumber);
            // 检查订单金额是否匹配
            var betCount    = CheckBettingOrderMoney(info.AnteCodeList, gameCode, info.GameType, info.PlayType, info.Amount, info.TotalMoney, stopTime, false, userId);
            var userManager = new UserBalanceManager();
            var user        = userManager.LoadUserRegister(userId);

            //开启事务
            using (DB)
            {
                //biz.BeginTran();
                DB.Begin();
                try
                {
                    AddRunningOrderAndOrderDetail(schemeId, info.BettingCategory, info.GameCode, info.GameType, info.PlayType, true, info.IssuseNumber, info.Amount, betCount, info.TotalMatchCount, info.TotalMoney, stopTime,
                                                  info.SchemeSource, info.Security, SchemeType.SaveScheme, false, true, user.UserId, user.AgentId, info.CurrentBetTime, info.ActivityType, info.Attach, false, 0M, ProgressStatus.Waitting, TicketStatus.Waitting);
                    foreach (var item in info.AnteCodeList)
                    {
                        //sportsManager.AddSports_AnteCode(new C_Sports_AnteCode
                        //{
                        //    SchemeId = schemeId,
                        //    AnteCode = item.AnteCode,
                        //    BonusStatus = (int)BonusStatus.Waitting,
                        //    CreateTime = DateTime.Now,
                        //    GameCode = gameCode,
                        //    GameType = string.IsNullOrEmpty(item.GameType) ? info.GameType.ToUpper() : item.GameType.ToUpper(),
                        //    IsDan = item.IsDan,
                        //    IssuseNumber = info.IssuseNumber,
                        //    MatchId = item.MatchId,
                        //    PlayType = info.PlayType,
                        //    Odds = string.Empty,
                        //});
                        var c_entity = new C_Sports_AnteCode
                        {
                            SchemeId     = schemeId,
                            AnteCode     = item.AnteCode,
                            BonusStatus  = (int)BonusStatus.Waitting,
                            CreateTime   = DateTime.Now,
                            GameCode     = gameCode,
                            GameType     = string.IsNullOrEmpty(item.GameType) ? info.GameType.ToUpper() : item.GameType.ToUpper(),
                            IsDan        = item.IsDan,
                            IssuseNumber = info.IssuseNumber,
                            MatchId      = item.MatchId,
                            PlayType     = info.PlayType,
                            Odds         = string.Empty,
                        };

                        DB.GetDal <C_Sports_AnteCode>().Add(c_entity);
                    }
                    //C_UserSaveOrder
                    var C_UserSaveOrderEntity = new C_UserSaveOrder
                    {
                        SchemeId              = schemeId,
                        UserId                = userId,
                        GameCode              = info.GameCode,
                        GameType              = info.GameType,
                        PlayType              = info.PlayType,
                        SchemeType            = (int)SchemeType.SaveScheme,
                        SchemeSource          = (int)info.SchemeSource,
                        SchemeBettingCategory = (int)info.BettingCategory,
                        ProgressStatus        = (int)ProgressStatus.Waitting,
                        IssuseNumber          = info.IssuseNumber,
                        Amount                = info.Amount,
                        BetCount              = betCount,
                        TotalMoney            = info.TotalMoney,
                        StopTime              = stopTime,
                        CreateTime            = DateTime.Now,
                        StrStopTime           = stopTime.AddMinutes(-5).ToString("yyyyMMddHHmm"),
                    };
                    //用户的订单保存
                    //sportsManager.AddUserSaveOrder(new C_UserSaveOrder
                    //{
                    //    SchemeId = schemeId,
                    //    UserId = userId,
                    //    GameCode = info.GameCode,
                    //    GameType = info.GameType,
                    //    PlayType = info.PlayType,
                    //    SchemeType = SchemeType.SaveScheme,
                    //    SchemeSource = info.SchemeSource,
                    //    SchemeBettingCategory = info.BettingCategory,
                    //    ProgressStatus = ProgressStatus.Waitting,
                    //    IssuseNumber = info.IssuseNumber,
                    //    Amount = info.Amount,
                    //    BetCount = betCount,
                    //    TotalMoney = info.TotalMoney,
                    //    StopTime = stopTime,
                    //    CreateTime = DateTime.Now,
                    //    StrStopTime = stopTime.AddMinutes(-5).ToString("yyyyMMddHHmm"),
                    //});

                    DB.Commit();
                }
                catch (Exception EX)
                {
                    DB.Rollback();
                    throw EX;
                }
            }
            return(schemeId);
        }