Beispiel #1
0
        private EuropeConfig(int p)
        {
            DateTime date = DateTime.Now;

            _season      = EuropeSeasonMgr.GetSeason(date);
            _gamblePoint = new Dictionary <int, GamblePointConfig>();
            _logoDic     = new Dictionary <string, int>();
            _prizeDic    = new Dictionary <int, List <ConfigEuropeprizeEntity> >();
            _winStepDic  = new Dictionary <int, int>();
            InitMatch();
            var europeGamble = CacheFactory.AppsettingCache.GetAppSetting(EnumAppsetting.EuropeGamblePoint);

            if (europeGamble.Length > 0)
            {
                var europe = europeGamble.Split('|');
                foreach (var s in europe)
                {
                    var list = s.Split(',');
                    if (list.Length > 2)
                    {
                        GamblePointConfig entity = new GamblePointConfig();
                        entity.GambleType = ConvertHelper.ConvertToInt(list[0]);
                        entity.Point      = ConvertHelper.ConvertToInt(list[1]);
                        entity.VipLevel   = ConvertHelper.ConvertToInt(list[2]);
                        _gamblePoint.Add(entity.GambleType, entity);
                    }
                }
            }
            var allPrize = ConfigEuropeprizeMgr.GetAll();

            foreach (var item in allPrize)
            {
                if (!_prizeDic.ContainsKey(item.Step))
                {
                    _prizeDic.Add(item.Step, new List <ConfigEuropeprizeEntity>());
                }
                _prizeDic[item.Step].Add(item);

                if (!_winStepDic.ContainsKey(item.WinNumber))
                {
                    _winStepDic.Add(item.WinNumber, item.Step);
                }
            }
            //_timer = new Timer();
            //_timer.Interval = 10000;
            //_timer.Elapsed += Timer_Elapsed;
            //_timer.Start();
            //_timer1 = new Timer();
            //_timer1.Interval = 600000;
            //_timer1.Elapsed += Timer_Elapsed1;
            //_timer1.Start();
        }
Beispiel #2
0
 /// <summary>
 /// 刷新活动信息
 /// </summary>
 /// <returns></returns>
 public MessageCode RefreshActivity()
 {
     try
     {
         DateTime date = DateTime.Now;
         _season = EuropeSeasonMgr.GetSeason(date);
     }
     catch (Exception ex)
     {
         SystemlogMgr.Error("欧洲杯刷活动信息", ex);
         return(MessageCode.NbParameterError);
     }
     return(MessageCode.Success);
 }
Beispiel #3
0
        public void SendPrize(int matchId, string zoneId)
        {
            DateTime date    = DateTime.Now;
            var      match   = EuropeMatchMgr.GetById(matchId);
            var      _season = EuropeSeasonMgr.GetSeason(date, zoneId);

            if (match == null)
            {
                return;
            }
            var season = EuropeSeasonMgr.GetSeason(date, zoneId);
            //获取未发奖的竞猜
            var sendPrizeList = EuropeGamblerecordMgr.GetNotPrize(matchId, zoneId);

            foreach (var item in sendPrizeList)
            {
                if (item.IsSendPrize)
                {
                    continue;
                }
                item.IsSendPrize = true;
                item.UpdateTime  = date;
                MailBuilder        mail       = null;
                EuropeGambleEntity gambleInfo = null;
                bool isInsertInfo             = false;
                if (item.GambleType == match.ResultType) //竞猜正确
                {
                    item.IsGambleCorrect = true;
                    item.ReturnPoint     = item.Point * 2;
                    //发邮件
                    mail = new MailBuilder(item.ManagerId, EnumMailType.Europe, item.ReturnPoint, match.HomeName,
                                           match.AwayName);
                    gambleInfo = EuropeGambleMgr.GetById(item.ManagerId, zoneId);
                    if (gambleInfo == null)
                    {
                        isInsertInfo = true;
                        gambleInfo   = new EuropeGambleEntity(item.ManagerId, 1, "0,0,0,0", date, date, season.Idx);
                    }
                    else
                    {
                        if (_season != null && gambleInfo.SeasonId != _season.Idx)
                        {
                            //插入记录
                            EuropeRecordMgr.Insert(new EuropeRecordEntity(0, gambleInfo.ManagerId, gambleInfo.SeasonId,
                                                                          gambleInfo.CorrectNumber, gambleInfo.PrizeRecord, date), null, zoneId);
                            //更新活动
                            gambleInfo.CorrectNumber = 0;
                            gambleInfo.PrizeRecord   = "0,0,0,0";
                            gambleInfo.SeasonId      = _season.Idx;
                        }
                        gambleInfo.CorrectNumber++;
                        gambleInfo.UpdateTime = date;
                    }
                }
                else
                {
                    item.IsGambleCorrect = false;
                }

                MessageCode code = MessageCode.FailUpdate;
                if (mail != null)
                {
                    if (!mail.Save(zoneId))
                    {
                        ShowMessage("发送邮件失败");
                        return;
                    }
                }
                if (gambleInfo != null)
                {
                    if (isInsertInfo)
                    {
                        if (!EuropeGambleMgr.Insert(gambleInfo, null, zoneId))
                        {
                            code = MessageCode.NbUpdateFail;
                        }
                    }
                    else
                    {
                        if (!EuropeGambleMgr.Update(gambleInfo, null, zoneId))
                        {
                            code = MessageCode.NbUpdateFail;
                        }
                    }
                }
                if (!EuropeGamblerecordMgr.Update(item, null, zoneId))
                {
                    code = MessageCode.NbUpdateFail;
                }
                if (code != MessageCode.Success)
                {
                    ShowMessage("保存失败");
                }
            }
        }