public void OrderPrize_AfterTranCommit(string userId, string schemeId, string gameCode, string gameType, string issuseNumber, decimal orderMoney, bool isBonus, decimal preTaxBonusMoney, decimal afterTaxBonusMoney, bool isVirtualOrder, DateTime prizeTime)
        {
            using (var biz = new GameBiz.Business.GameBizBusinessManagement())
            {
                biz.BeginTran();

                var sportsManager = new Sports_Manager();
                var order         = sportsManager.QuerySports_Order_Complate(schemeId);
                if (order == null)
                {
                    throw new LogicException(string.Format("自动分红,没有找到订单{0}", schemeId));
                }
                //if (order.IsPayRebate)
                //    throw new LogicException(string.Format("订单{0}已分红", schemeId));
                var bonusAwardsMoney = 0M;
                if (order.AddMoneyDescription.Contains("10"))
                {
                    bonusAwardsMoney = order.AddMoney;
                }
                var bonusMoney = (order.TotalMoney - order.RedBagMoney - order.AfterTaxBonusMoney + bonusAwardsMoney);
                if (order.TicketStatus == TicketStatus.Ticketed && !order.IsVirtualOrder)
                {
                    var msg = string.Empty;
                    //合买判断
                    if (order.SchemeType == SchemeType.TogetherBetting)
                    {
                        var main = sportsManager.QuerySports_Together(schemeId);
                        if (main == null)
                        {
                            msg = string.Format("找不到合买订单:{0}", schemeId);
                        }
                        var sysJoinEntity = sportsManager.QuerySports_TogetherJoin(schemeId, TogetherJoinType.SystemGuarantees);
                        if (sysJoinEntity != null && sysJoinEntity.RealBuyCount > 0)
                        {
                            msg = "网站参与保底,不分红";
                        }

                        if (main.SoldCount + main.Guarantees < main.TotalCount)
                        {
                            throw new Exception("订单未满员,不执行分红");
                        }
                    }

                    if (string.IsNullOrEmpty(msg))
                    {
                        var userManager    = new UserBalanceManager();
                        var ocAgentManager = new OCAgentManager();
                        var orderGameType  = string.Empty;
                        if (new string[] { "CTZQ", "BJDC", "JCZQ", "JCLQ" }.Contains(order.GameCode))
                        {
                            orderGameType = order.GameType;
                        }

                        PayOrderBonus(userManager, ocAgentManager, order.SchemeId, order.SchemeType, order.UserId, order.GameCode, orderGameType, order.UserId, bonusMoney, 0);
                    }
                }

                order.IsPayRebate = true;
                sportsManager.UpdateSports_Order_Complate(order);

                biz.CommitTran();
            }
        }
        /// <summary>
        /// 返点接口
        /// </summary>
        public void ManualAgentPayIn(string schemeId)
        {
            var order = new SchemeManager().QueryOrderDetail(schemeId);

            if (order == null)
            {
                throw new LogicException(string.Format("找不到订单 :{0} ", schemeId));
            }
            if (order.TicketStatus != TicketStatus.Ticketed)
            {
                throw new LogicException("订单未出票完成,不能返点");
            }
            if (order.IsVirtualOrder)
            {
                throw new LogicException("虚拟订单不能返点");
            }

            string          currentUserId   = string.Empty;
            decimal         currentBetMoney = 0M;
            string          currentGameCode = string.Empty;
            bool            currentIsAgent  = false;
            OCAgentBusiness busi            = new OCAgentBusiness();

            using (var biz = new GameBiz.Business.GameBizBusinessManagement())
            {
                biz.BeginTran();

                //查询订单信息
                var sportsManager = new Sports_Manager();

                //真实订单,处理返点数据
                var gameCode = order.GameCode.ToUpper();
                var gameType = order.GameType.ToUpper();
                var userId   = order.UserId;

                var msg = string.Empty;
                //合买判断
                if (order.SchemeType == SchemeType.TogetherBetting)
                {
                    var main = sportsManager.QuerySports_Together(schemeId);
                    if (main == null)
                    {
                        msg = string.Format("找不到合买订单:{0}", schemeId);
                        //throw new Exception(string.Format("找不到合买订单:{0}", schemeId));
                    }
                    //if (main.ProgressStatus != TogetherSchemeProgress.Finish)
                    //    throw new Exception(string.Format("合买订单:{0} 状态不正确", schemeId));
                    var sysJoinEntity = sportsManager.QuerySports_TogetherJoin(schemeId, TogetherJoinType.SystemGuarantees);
                    if (sysJoinEntity != null && sysJoinEntity.RealBuyCount > 0)
                    {
                        msg = "网站参与保底,不返点";
                        //throw new Exception("网站参与保底,不返点");
                    }

                    if (main.SoldCount + main.Guarantees < main.TotalCount)
                    {
                        throw new Exception("订单未满员,不执行返点");
                    }
                    //realMoney -= main.SystemGuarantees * main.Price;
                }

                var realMoney           = 0M;;
                var totalPayRebateMoney = 0M;
                var agentManager        = new OCAgentManager();
                if (string.IsNullOrEmpty(msg))
                {
                    //没有异常,执行返点
                    var noGameTypeArray = new string[] { "CQSSC", "JX11X5", "SSQ", "DLT", "FC3D", "PL3" };
                    if (noGameTypeArray.Contains(gameCode))
                    {
                        gameType = string.Empty;
                    }

                    //真实投注金额,订单成功金额
                    realMoney = order.TotalMoney;
                    //查询用户自身返点
                    var balanceManager = new UserBalanceManager();
                    var user           = balanceManager.QueryUserRegister(userId);
                    currentIsAgent = user.IsAgent;

                    //去掉红包参与金额
                    var redBagJoinMoney = order.RedBagMoney;// new FundManager().QuerySchemeRedBagTotalJoinMoney(schemeId);
                    realMoney -= redBagJoinMoney;
                    //递归调用
                    int rebateType  = 0;
                    var arrGameCode = new string[] { "JCZQ", "JCLQ", "BJDC" };
                    if (!string.IsNullOrEmpty(order.PlayType) && arrGameCode.Contains(order.GameCode))
                    {
                        if (order.PlayType == "1_1")
                        {
                            rebateType = 1;
                        }
                    }
                    totalPayRebateMoney = busi.PayOrderRebate(agentManager, user, schemeId, userId, order.SchemeType, gameCode, gameType, order.TotalMoney, realMoney, 0, rebateType);
                }

                biz.CommitTran();
            }
            //计算代理销量
            busi.CalculationAgentSales(currentUserId, currentGameCode, currentBetMoney, currentIsAgent, 0);
        }