Beispiel #1
0
        public void Run()
        {
            var pkService    = new PKService();
            var bonusService = new PKBonusService();
            var betService   = new BetService();

            var pks = pkService.GetNotBonusPKs();

            foreach (var pk in pks)
            {
                if (pk != null && !string.IsNullOrEmpty(pk.Ranks))
                {
                    // 生成奖金
                    if (!pk.IsBonused)
                    {
                        // 更新 奖金生成标志, 防止多次计算
                        pkService.UpdateIsBonused(pk.PKId, true);
                        // 生成奖金
                        bonusService.GenerateBonus(pk);

                        var msg = string.Format("Generate Bonus - PKId : {0} - Time : {1}", pk.PKId, DateTime.Now.ToString(DateFormatConst.yMd_Hms));
                        _logger.Info(msg);
                    }
                }
            }

            // 更新Bet表已结算标志
            betService.UpdateSettlementDone();
        }
Beispiel #2
0
        public void Run()
        {
            var pkService    = new PKService();
            var bonusService = new PKBonusService();

            var pk = pkService.GetNotBonusPKs();

            if (pk != null)
            {
                // 生成奖金
                if (!pk.IsBonused)
                {
                    // 更新 奖金生成标志, 防止多次计算
                    pkService.UpdateIsBonused(pk.PKId, true);


                    // 生成奖金
                    var bonus = GetBonus(pk);
                    if (bonus != null && bonus.Count > 0)
                    {
                        bonusService.GenerateBonus(bonus);
                    }

                    var msg = string.Format("[PkGameBonusJob] Generate Bonus - PKId : {0} - Time : {1} - Bonus Count : {2}", pk.PKId, DateTime.Now.ToString(DateFormatConst.yMd_Hms), bonus.Count);
                    _logger.Info(msg);
                }
            }
        }
Beispiel #3
0
        public void Run()
        {
            var pkService    = new PKService();
            var bonusService = new PKBonusService();
            var betService   = new BetService();

            //var pk = pkService.GetCurrentPK();

            var pks = pkService.GetNotCalculatePKs();

            foreach (var pk in pks)
            {
                if (pk != null && string.IsNullOrEmpty(pk.Ranks))
                {
                    var now = DateTime.Now;
                    if (now >= pk.BeginTime.AddSeconds(pk.OpeningSeconds))// 封盘
                    {
                        // 计算名次
                        var rankList = betService.CalculateRanks(pk.PKId);
                        var ranks    = string.Join(",", rankList);
                        pk.Ranks = ranks;
                        pkService.UpdateRanks(pk.PKId, ranks);

                        var msg = string.Format("Calculate Ranks - PKId : {0} - Ranks : {1} - Time : {2}", pk.PKId, ranks, now.ToString(DateFormatConst.yMd_Hms));
                        _logger.Info(msg);

                        // 生成奖金
                        if (!pk.IsBonused)
                        {
                            // 更新 奖金生成标志, 防止多次计算
                            pkService.UpdateIsBonused(pk.PKId, true);
                            // 生成奖金
                            bonusService.GenerateBonus(pk);
                        }
                    }
                }
            }

            // 更新Bet表已结算标志
            betService.UpdateSettlementDone();
        }