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);
        }
Exemple #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>());
     }
 }
Exemple #3
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>());
     }
 }
Exemple #4
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>());
     }
 }
Exemple #5
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>());
     }
 }
Exemple #6
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>());
     }
 }
        /// <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);
        }
        /// <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);
        }
Exemple #9
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>());
            }
        }
        /// <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);
            }
        }