コード例 #1
0
        public static void DisplayIpaddress()
        {
            try
            {
                const string linkDescription = @"您可以通过以下链接访问:";
                Log4Log.Info(linkDescription);
                ContentLog.WriteLine(linkDescription);

                var hostName    = Dns.GetHostName();
                var ipHostEntry = Dns.GetHostEntry(hostName);
                ipHostEntry
                .AddressList
                .Where(item => item.AddressFamily == AddressFamily.InterNetwork)
                .ToList()
                .ForEach(item =>
                {
                    var url = string.Format(@"http://{0}", item);
                    Log4Log.Info(url);
                    ContentLog.WriteLine(url);
                });
            }
            catch (Exception ex)
            {
                var exceptionMessage = @"获取本机IP出错:" + ex.Message;
                Log4Log.Info(exceptionMessage);
                ContentLog.WriteLine(exceptionMessage);
            }
        }
コード例 #2
0
 public static Dictionary <string, string> QuerySJBWinNumber()
 {
     try
     {
         var db      = RedisHelperEx.DB_Match;
         var fullKey = string.Format("{0}_{1}", "SJB", RedisKeys.Key_MatchResult_List);
         var array   = db.LRange(fullKey, 0, -1);
         var dic     = new Dictionary <string, string>();
         foreach (var item in array)
         {
             if (string.IsNullOrEmpty(item))
             {
                 continue;
             }
             var k_v = item.ToString().Split('^');
             if (k_v.Length != 2)
             {
                 continue;
             }
             dic.Add(k_v[0], k_v[1]);
         }
         return(dic);
     }
     catch (Exception ex)
     {
         Log4Log.Error("RedisMatchBusiness-QuerySJBWinNumber", ex);
         //writer.Write("RedisMatchBusiness", "QuerySJBWinNumber", ex);
         return(new Dictionary <string, string>());
     }
 }
コード例 #3
0
        public object ExecPlugin(string type, object inputParam)
        {
            try
            {
                var paraList = inputParam as object[];
                switch (type)
                {
                case "IComplateTicket":
                    ComplateTicket((string)paraList[0], (string)paraList[1], (decimal)paraList[2], (decimal)paraList[3]);
                    break;

                case "IOrderPrize_AfterTranCommit":
                    OrderPrize_AfterTranCommit((string)paraList[0], (string)paraList[1], (string)paraList[2], (string)paraList[3], (string)paraList[4], (decimal)paraList[5], (bool)paraList[6], (decimal)paraList[7], (decimal)paraList[8], (bool)paraList[9], (DateTime)paraList[10]);
                    break;

                default:
                    throw new ArgumentOutOfRangeException("不支持的插件类型 - " + type);
                }
                return(null);
            }
            catch (LogicException)
            {
            }
            catch (Exception ex)
            {
                Log4Log.Error("EXEC_Plugin_AddA20140902_Business购彩不花钱_Error_", ex);
            }

            return(null);
        }
コード例 #4
0
        public HttpResponseMessage Open(string path)
        {
            Log4Log.Info(Request.ToString());
            ContentLog.WriteLine(Request.ToString());

            var httpResponseMessage = Request.Response(path);

            Log4Log.Info(httpResponseMessage.ToString());
            ContentLog.WriteLine(httpResponseMessage.ToString());

            return(httpResponseMessage);
        }
コード例 #5
0
        public static void RegConfigFile(string fileName)
        {
            _configFileName = fileName;
            var configWatcher = new FCFileWatcher(Path.GetDirectoryName(fileName), Path.GetFileName(fileName));

            configWatcher.Changed += (object sender, FileSystemEventArgs e) =>
            {
                Log4Log.Info("SensitiveChanged-SensitiveRegister.Sensitive-SensitiveRegister.Sensitive-文件监控发现系统敏感文件已更新");
                UpdateSensitive();
            };
            configWatcher.Start();
        }
コード例 #6
0
        public static void RegConfigFile(string fileName)
        {
            _configFileName = fileName;
            var configWatcher = new FCFileWatcher(Path.GetDirectoryName(fileName), Path.GetFileName(fileName));

            configWatcher.Changed += (object sender, FileSystemEventArgs e) =>
            {
                Log4Log.Info("ConfigChanged-AgentMapping.Config-AgentMapping.Config-文件监控发现代理商域名映射配置信息文件已更新");
                _allAgentList.Clear();
            };
            configWatcher.Start();
        }
コード例 #7
0
        public static void RegConfigFile(string fileName)
        {
            _configFileName = fileName;
            var configWatcher = new FCFileWatcher(Path.GetDirectoryName(fileName), Path.GetFileName(fileName));

            configWatcher.Changed += (object sender, FileSystemEventArgs e) =>
            {
                Log4Log.Info("ConfigChanged-SettingConfigRegister.Configuration-SettingConfigRegister.Configuration-文件监控发现系统配置文件已更新");
                _allConfigList.Clear();
                xElement.Clear();
            };
            configWatcher.Start();
        }
コード例 #8
0
        public HttpResponseMessage Index()
        {
            var path = Application.StartupPath;

            Log4Log.Info(Request.ToString());
            ContentLog.WriteLine(Request.ToString());

            var httpResponseMessage = Request.Response(path);

            Log4Log.Info(httpResponseMessage.ToString());
            ContentLog.WriteLine(httpResponseMessage.ToString());

            return(httpResponseMessage);
        }
コード例 #9
0
 /// <summary>
 /// 查询竞彩足球比赛结果
 /// </summary>
 public static List <JCZQ_MatchResult> QueryJCZQMatchResult()
 {
     try
     {
         var db         = RedisHelperEx.DB_Match;
         var fullKey    = string.Format("{0}_{1}", "JCZQ", RedisKeys.Key_MatchResult_List);
         var json       = db.GetAsync(fullKey).Result;
         var resultList = JsonHelper.Deserialize <List <JCZQ_MatchResult> >(json);
         return(resultList);
     }
     catch (Exception ex)
     {
         Log4Log.Error("RedisMatchBusiness-QueryJCZQMatchResult", ex);
         return(new List <JCZQ_MatchResult>());
     }
 }
コード例 #10
0
 /// <summary>
 /// 查询数字彩中奖规则
 /// </summary>
 public static List <C_Bonus_Rule> QuerySZCBonusRule()
 {
     try
     {
         var db         = RedisHelperEx.DB_Match;
         var fullKey    = "SZC_Bonus_Rule_List";
         var json       = db.GetAsync(fullKey).Result;
         var resultList = JsonHelper.Deserialize <List <C_Bonus_Rule> >(json);
         return(resultList);
     }
     catch (Exception ex)
     {
         Log4Log.Error("RedisMatchBusiness-QuerySZCBonusRule", ex);
         //writer.Write("RedisMatchBusiness", "QuerySZCBonusRule", ex);
         return(new List <C_Bonus_Rule>());
     }
 }
コード例 #11
0
 /// <summary>
 /// 查询传统足球比赛结果
 /// </summary>
 public static List <EntityModel.T_Ticket_BonusPool> QuseryCTZQBonusPool(string gameType)
 {
     try
     {
         var db         = RedisHelperEx.DB_Match;
         var fullKey    = string.Format("CTZQ_{0}_{1}", gameType, RedisKeys.Key_MatchResult_List);
         var json       = db.GetAsync(fullKey).Result;
         var resultList = JsonHelper.Deserialize <List <EntityModel.T_Ticket_BonusPool> >(json);
         return(resultList);
     }
     catch (Exception ex)
     {
         Log4Log.Error("RedisMatchBusiness-QuseryCTZQBonusPool_", ex);
         //  writer.Write("RedisMatchBusiness", "QuseryCTZQBonusPool_" + gameType, ex);
         return(new List <EntityModel.T_Ticket_BonusPool>());
     }
 }
コード例 #12
0
 /// <summary>
 /// 查询北京单场比赛结果
 /// </summary>
 public static List <EntityModel.C_BJDC_MatchResult_Prize> QueryBJDCMatchResult()
 {
     try
     {
         var db         = RedisHelperEx.DB_Match;
         var fullKey    = string.Format("{0}_{1}", "BJDC", RedisKeys.Key_MatchResult_List);
         var json       = db.GetAsync(fullKey).Result;
         var resultList = JsonHelper.Deserialize <List <EntityModel.C_BJDC_MatchResult_Prize> >(json);
         return(resultList);
     }
     catch (Exception ex)
     {
         Log4Log.Error("RedisMatchBusiness-QueryBJDCMatchResult", ex);
         // writer.Write("RedisMatchBusiness", "QueryBJDCMatchResult", ex);
         return(new List <EntityModel.C_BJDC_MatchResult_Prize>());
     }
 }
コード例 #13
0
        /// <summary>
        /// 多线程执行拆票(普通投注)
        /// </summary>
        public static void DoSplitOrderTicketWithThread(RedisWaitTicketOrder order)
        {
            if (order == null || order.RunningOrder == null || order.AnteCodeList == null || order.AnteCodeList.Count <= 0)
            {
                return;
            }

            ThreadPool.QueueUserWorkItem((o) =>
            {
                try
                {
                    DoSplitOrderTicket(o as RedisWaitTicketOrder);
                }
                catch (Exception ex)
                {
                    Log4Log.Error("Redis_DoSplitOrderTicket-DoSplitOrderTicketWithThread", ex);
                }
            }, order);
        }
コード例 #14
0
        /// <summary>
        /// 多线程执行拆票(单式投注)
        /// </summary>
        public static void DoSplitOrderTicketWithThread_Single(RedisWaitTicketOrderSingle order)
        {
            if (order == null || order.AnteCode == null)
            {
                return;
            }

            ThreadPool.QueueUserWorkItem((o) =>
            {
                try
                {
                    DoSplitOrderTicket_Single(o as RedisWaitTicketOrderSingle);
                }
                catch (Exception ex)
                {
                    Log4Log.Error("Redis_DoSplitOrderTicket_Single-DoSplitOrderTicketWithThread_Single", ex);
                }
            }, order);
        }
コード例 #15
0
        public HttpResponseMessage Play(HttpRequestMessage request, string filePath)
        {
            Log4Log.Info(Request.ToString());
            ContentLog.WriteLine(Request.ToString());

            try
            {
                var assembly       = Assembly.GetExecutingAssembly();
                var resourceStream = assembly.GetManifestResourceStream("YYX.FileFinder.video.html");
                if (resourceStream == null)
                {
                    throw new Exception("页面异常");
                }
                var response = request.CreateResponse(HttpStatusCode.OK);
                using (var stream = new StreamReader(resourceStream))
                {
                    var html = stream.ReadToEnd();
                    var urlEncodeFilePath = HttpUtility.UrlEncode(filePath);
                    var videoLink         = $"/File/Download?filePath={urlEncodeFilePath}";
                    html = html.Replace("{videoLink}", videoLink);

                    response.Content = new StringContent(html, Encoding.UTF8);
                    response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
                }

                Log4Log.Info(response.ToString());
                ContentLog.WriteLine(response.ToString());

                return(response);
            }
            catch (Exception exception)
            {
                var httpResponseMessage = Request.CreateErrorResponse(HttpStatusCode.NotFound, exception.Message);

                Log4Log.Info(httpResponseMessage.ToString());
                ContentLog.WriteLine(httpResponseMessage.ToString());

                return(httpResponseMessage);
            }
        }
コード例 #16
0
        public HttpResponseMessage Download(string filePath)
        {
            Log4Log.Info(Request.ToString());
            ContentLog.WriteLine(Request.ToString());

            if (File.Exists(filePath) == false)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "文件未找到"));
            }
            var response = new HttpResponseMessage(HttpStatusCode.OK);
            var fileName = Path.GetFileName(filePath);

            try
            {
                var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
                {
                    response.Content = new StreamContent(fileStream);
                    response.Content.Headers.ContentType        = new MediaTypeHeaderValue("application/octet-stream");
                    response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
                    {
                        FileName = fileName
                    };
                }

                Log4Log.Info(response.ToString());
                ContentLog.WriteLine(response.ToString());


                return(response);
            }
            catch (Exception exception)
            {
                var httpResponseMessage = Request.CreateErrorResponse(HttpStatusCode.NotFound, exception.Message);

                Log4Log.Info(httpResponseMessage.ToString());
                ContentLog.WriteLine(httpResponseMessage.ToString());

                return(httpResponseMessage);
            }
        }
コード例 #17
0
        /// <summary>
        /// 查询数字彩奖池数据
        /// </summary>
        public static List <EntityModel.T_Ticket_BonusPool> QuserySZCBonusPool(string gameCode)
        {
            try
            {
                var gameCodeArray = new string[] { "SSQ", "DLT" };
                if (!gameCodeArray.Contains(gameCode))
                {
                    return(new List <T_Ticket_BonusPool>());
                }

                var db         = RedisHelperEx.DB_Match;
                var fullKey    = string.Format("{0}_{1}", gameCode, RedisKeys.Key_SZC_BonusPool);
                var json       = db.GetAsync(fullKey).Result;
                var resultList = JsonHelper.Deserialize <List <T_Ticket_BonusPool> >(json);
                return(resultList);
            }
            catch (Exception ex)
            {
                Log4Log.Error("RedisMatchBusiness-QuserySZCBonusPool_", ex);
                // writer.Write("RedisMatchBusiness", "QuserySZCBonusPool_" + gameCode, ex);
                return(new List <T_Ticket_BonusPool>());
            }
        }
コード例 #18
0
        /// <summary>
        /// 执行拆票(普通投注)
        /// </summary>
        public static void DoSplitOrderTicket(RedisWaitTicketOrder order)
        {
            //if (!BusinessHelper.CanRequestBet(order.RunningOrder.GameCode))
            //    return;
            var DB = new DBbase().DB;// DBbase

            try
            {
                var sportsManager = new Sports_Manager();
                var oldCount      = DB.CreateQuery <C_Sports_Ticket>().Where(p => p.SchemeId == order.RunningOrder.SchemeId).Count(); //sportsManager.QueryTicketCount(order.RunningOrder.SchemeId);
                if (oldCount <= 0)
                {
                    //清理冻结
                    if (order.RunningOrder.SchemeType == (int)SchemeType.ChaseBetting)
                    {
                        BusinessHelper.Payout_Frozen_To_End(BusinessHelper.FundCategory_Betting, order.RunningOrder.UserId, order.RunningOrder.SchemeId, string.Format("订单{0}出票完成,扣除冻结{1:N2}元", order.RunningOrder.SchemeId, order.RunningOrder.TotalMoney), order.RunningOrder.TotalMoney);
                    }

                    //普通投注
                    var jcGameCodeArray = new string[] { "BJDC", "JCZQ", "JCLQ" };
                    if (jcGameCodeArray.Contains(order.RunningOrder.GameCode))
                    {
                        //竞彩
                        #region 拆票

                        var betInfo = new GatewayTicketOrder_Sport
                        {
                            Amount          = order.RunningOrder.Amount,
                            Attach          = order.RunningOrder.Attach,
                            GameCode        = order.RunningOrder.GameCode,
                            GameType        = order.RunningOrder.GameType,
                            IssuseNumber    = order.RunningOrder.IssuseNumber,
                            IsVirtualOrder  = order.RunningOrder.IsVirtualOrder,
                            OrderId         = order.RunningOrder.SchemeId,
                            PlayType        = order.RunningOrder.PlayType,
                            UserId          = order.RunningOrder.UserId,
                            TotalMoney      = order.RunningOrder.TotalMoney,
                            Price           = 2M,
                            IsRunningTicket = true,
                        };
                        foreach (var code in order.AnteCodeList)
                        {
                            betInfo.AnteCodeList.Add(new GatewayAnteCode_Sport
                            {
                                AnteCode = code.AnteCode,
                                GameType = code.GameType,
                                IsDan    = code.IsDan,
                                MatchId  = code.MatchId,
                            });
                        }
                        new Sports_Business().RequestTicket_Sport(betInfo);

                        //new Thread(() =>
                        //{
                        try
                        {
                            //生成文件
                            var json = JsonHelper.Serialize(betInfo);
                            var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CacheData", "Orders", DateTime.Today.ToString("yyyyMMdd"), order.RunningOrder.GameCode, order.RunningOrder.SchemeId.Substring(0, 10));
                            if (!Directory.Exists(path))
                            {
                                Directory.CreateDirectory(path);
                            }
                            var fileName = Path.Combine(path, string.Format("{0}.json", order.RunningOrder.SchemeId));
                            File.WriteAllText(fileName, json, Encoding.UTF8);
                        }
                        catch (Exception)
                        {
                        }
                        //}).Start();
                        #endregion
                    }
                    else
                    {
                        //数字彩、传统足球
                        #region 拆票

                        var betInfo = new GatewayTicketOrder
                        {
                            Amount          = order.RunningOrder.Amount,
                            GameCode        = order.RunningOrder.GameCode,
                            IssuseNumber    = order.RunningOrder.IssuseNumber,
                            OrderId         = order.RunningOrder.SchemeId,
                            Price           = ((order.RunningOrder.IsAppend && order.RunningOrder.GameCode == "DLT") ? 3M : 2M),
                            TotalMoney      = order.RunningOrder.TotalMoney,
                            IsVirtualOrder  = false,
                            Attach          = "",
                            IsAppend        = order.RunningOrder.IsAppend,
                            UserId          = order.RunningOrder.UserId,
                            IsRunningTicket = true,
                        };
                        foreach (var item in order.AnteCodeList)
                        {
                            betInfo.AnteCodeList.Add(new GatewayAnteCode
                            {
                                AnteNumber = item.AnteCode,
                                GameType   = item.GameType,
                            });
                        }

                        //new Sports_Business().RequestTicket(betInfo, order.KeyLine, order.StopAfterBonus, order.SchemeType);

                        new Sports_Business().RequestTicket2(betInfo, order.KeyLine, order.StopAfterBonus, order.SchemeType);
                        //new Thread(() =>
                        //{

                        try
                        {
                            //生成文件
                            var json = JsonHelper.Serialize(betInfo);
                            var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CacheData", "Orders", DateTime.Today.ToString("yyyyMMdd"), order.RunningOrder.GameCode, order.RunningOrder.SchemeId.Substring(0, 10));
                            if (!Directory.Exists(path))
                            {
                                Directory.CreateDirectory(path);
                            }
                            var fileName = Path.Combine(path, string.Format("{0}.json", order.RunningOrder.SchemeId));
                            File.WriteAllText(fileName, json, Encoding.UTF8);
                        }
                        catch (Exception)
                        {
                        }

                        //}).Start();

                        #endregion
                    }

                    //更新订单状态
                    UpdateOrderTicketStatus(order.RunningOrder.SchemeId);

                    //触发出票完成接口
                    BusinessHelper.ExecPlugin <IComplateTicket>(new object[] { order.RunningOrder.UserId, order.RunningOrder.SchemeId, order.RunningOrder.TotalMoney, order.RunningOrder.TotalMoney });
                }
            }
            catch (Exception exp)
            {
                Log4Log.Error("追号订单自动拆票任务-DoSplitOrderTicket", exp);
                // writerLog("Redis_DoSplitOrderTicket-DoSplitOrderTicketWithThread", ex);
                //  writerLog.WriteLog("追号订单自动拆票任务", "DoSplitOrderTicket",(int) LogType.Information, "追号订单自动拆票任务日志", exp.Message);
            }
        }