Example #1
0
        public GambleStonePlayerBetRecord[] GetLastMonthGambleStonePlayerBetRecord(string token)
        {
            if (RSAProvider.LoadRSA(token))
            {
                string userName = null;
                try
                {
                    userName = ClientManager.GetClientUserName(token);
                    var player = PlayerController.Instance.GetPlayerInfoByUserName(userName);
                    if (player == null)
                    {
                        return(null);
                    }

                    return(DBProvider.GambleStoneDBProvider.GetLastMonthGambleStonePlayerBetRecord(player.SimpleInfo.UserID));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[ " + userName + " ] GetGambleStoneInningInfo 异常。", exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        public BuyStonesOrder[] SearchUserBuyStoneOrders(string token, string sellerUserName, string orderNumber, string buyUserName, int orderState, MyDateTime myBeginCreateTime, MyDateTime myEndCreateTime, MyDateTime myBeginBuyTime, MyDateTime myEndBuyTime, int pageItemCount, int pageIndex)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    if (ClientManager.GetClientUserName(token) != buyUserName)
                    {
                        return(null);
                    }

                    return(DBProvider.StoneOrderDBProvider.GetBuyStonesOrderList(sellerUserName, orderNumber, buyUserName, orderState, myBeginCreateTime, myEndCreateTime, myBeginBuyTime, myEndBuyTime, pageItemCount, pageIndex));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + buyUserName + "] 查询矿石购买历史订单异常", exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        public bool SaveRouletteLargeWinMultiple(string token, decimal multiple)
        {
            if (RSAProvider.LoadRSA(token))
            {
                string adminUserName = "";
                try
                {
                    if (multiple < 1)
                    {
                        return(false);
                    }
                    adminUserName = AdminManager.GetClientUserName(token);

                    GlobalConfig.RouletteConfig.RouletteLargeWinMultiple = multiple;
                    bool isOK = DBProvider.SystemDBProvider.SaveRouletteConfig(GlobalConfig.RouletteConfig);
                    LogHelper.Instance.AddInfoLog("管理员[" + adminUserName + "]修改了幸运大转盘中奖倍数为:" + multiple);

                    return(isOK);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("SaveRouletteLargeWinMultiple Exception. adminUserName:" + adminUserName, exc);
                    return(false);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        public bool ReleaseLockOrder(string token, string orderNumber)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                string userName = "";
                try
                {
                    //userName = ClientManager.GetClientUserName(token);
                    //return OrderController.Instance.StoneOrderController.ReleaseLockSellOrder(orderNumber);
                    return(false);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 解除锁定订单" + orderNumber + ",异常", exc);
                    return(false);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        /// <summary>
        /// RESULTCODE_USER_NOT_EXIST; RESULTCODE_ORDER_NOT_EXIST; RESULTCODE_EXCEPTION; RESULTCODE_ORDER_NOT_BE_LOCKED; RESULTCODE_ORDER_NOT_BELONE_CURRENT_PLAYER; RESULTCODE_TRUE; RESULTCODE_FALSE;
        /// </summary>
        /// <param name="token"></param>
        /// <param name="orderNumber"></param>
        /// <returns></returns>
        public int SetStoneOrderPayException(string token, string orderNumber)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                return(OperResult.RESULTCODE_FALSE);

                //string userName = "";
                //try
                //{
                //    userName = ClientManager.GetClientUserName(token);
                //    if (string.IsNullOrEmpty(userName))
                //    {
                //        return OperResult.RESULTCODE_USER_NOT_EXIST;
                //    }

                //    return OrderController.Instance.StoneOrderController.SetStoneOrderPayException(userName, orderNumber);
                //}
                //catch (Exception exc)
                //{
                //    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 申诉矿石订单" + orderNumber + ",异常", exc);
                //    return OperResult.RESULTCODE_EXCEPTION;
                //}
            }
            else
            {
                throw new Exception();
            }
        }
        public LockSellStonesOrder LockSellStone(string token, string userName, string orderNumber)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    //if (ClientManager.GetClientUserName(token) != userName)
                    //{
                    return(null);
                    //}

                    //if (OrderController.Instance.StoneOrderController.CheckUserHasNotPayOrder(userName))
                    //{
                    //    return null;
                    //}

                    //return OrderController.Instance.StoneOrderController.LockSellStone(userName, orderNumber);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 锁定矿石订单异常", exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        public bool CheckUserHasNotPayOrder(string token)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    return(false);

                    //    string userName = ClientManager.GetClientUserName(token);
                    //    return OrderController.Instance.StoneOrderController.CheckUserHasNotPayOrder(userName);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("检查玩家是否存在未支付的订单异常", exc);
                    return(true);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        public LockSellStonesOrder GetOrderLockedBySelf(string token)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                string userName = "";
                try
                {
                    return(null);
                    //userName = ClientManager.GetClientUserName(token);
                    //return OrderController.Instance.StoneOrderController.GetLockedOrderByUserName(userName);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 获取自己锁定订单异常", exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="token"></param>
        /// <param name="userName"></param>
        /// <param name="buyStonesCount"></param>
        /// <returns></returns>
        public LockSellStonesOrder AutoMatchLockSellStone(string token, string userName, int buyStonesCount)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                //if (ClientManager.GetClientUserName(token) != userName)
                //{
                return(null);
                //}

                //if (OrderController.Instance.StoneOrderController.CheckUserHasNotPayOrder(userName))
                //{
                //    return null;
                //}

                //return OrderController.Instance.StoneOrderController.AutoMatchLockSellStone(userName, buyStonesCount);
            }
            else
            {
                throw new Exception();
            }
        }
        /// <summary>
        /// RESULTCODE_ORDER_NOT_EXIST; RESULTCODE_USER_NOT_EXIST; RESULTCODE_EXCEPTION; RESULTCODE_ORDER_NOT_EXIST; RESULTCODE_ORDER_NOT_BELONE_CURRENT_PLAYER; RESULTCODE_ORDER_BE_LOCKED; RESULTCODE_TRUE; RESULTCODE_FALSE
        /// </summary>
        /// <param name="token"></param>
        /// <param name="userName"></param>
        /// <param name="orderNumber"></param>
        /// <returns></returns>
        public int CancelSellStone(string token, string userName, string orderNumber)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                if (string.IsNullOrEmpty(orderNumber))
                {
                    return(OperResult.RESULTCODE_ORDER_NOT_EXIST);
                }
                if (ClientManager.GetClientUserName(token) != userName)
                {
                    return(OperResult.RESULTCODE_USER_NOT_EXIST);
                }

                try
                {
                    //return OrderController.Instance.StoneOrderController.CancelSellOrder(userName, orderNumber);
                    return(OperResult.RESULTCODE_FALSE);
                }
                catch (Exception exc)
                {
                    string errMessage = "玩家: " + userName + " 取消矿石出售订单: " + orderNumber + " 异常.";
                    LogHelper.Instance.AddErrorLog(errMessage, exc);
                    return(OperResult.RESULTCODE_EXCEPTION);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Example #11
0
 public MetaData.Game.StoneStack.StoneDelegateBuyOrderInfo[] GetFinishedDelegateBuyStoneOrders(string token, MetaData.MyDateTime myBeginCreateTime, MetaData.MyDateTime myEndCreateTime, int pageItemCount, int pageIndex)
 {
     if (RSAProvider.LoadRSA(token))
     {
         string userName = "";
         try
         {
             userName = ClientManager.GetClientUserName(token);
             if (string.IsNullOrEmpty(userName))
             {
                 return(null);
             }
             return(DBProvider.StoneStackDBProvider.GetAllFinishedStoneDelegateBuyOrderInfoByPlayer(userName, myBeginCreateTime, myEndCreateTime, pageItemCount, pageIndex));
         }
         catch (Exception exc)
         {
             LogHelper.Instance.AddErrorLog("玩家[" + userName + "] GetFinishedDelegateBuyStoneOrders Exception", exc);
             return(null);
         }
     }
     else
     {
         throw new Exception();
     }
 }
Example #12
0
 public MetaData.Game.StoneStack.StoneDelegateBuyOrderInfo[] GetNotFinishedDelegateBuyStoneOrders(string token)
 {
     if (RSAProvider.LoadRSA(token))
     {
         string userName = "";
         try
         {
             userName = ClientManager.GetClientUserName(token);
             var playerInfo = PlayerController.Instance.GetPlayerInfoByUserName(userName);
             if (playerInfo == null)
             {
                 return(null);
             }
             return(DBProvider.StoneStackDBProvider.GetNotFinishedStoneDelegateBuyOrderInfoByPlayer(playerInfo.SimpleInfo.UserID));
         }
         catch (Exception exc)
         {
             LogHelper.Instance.AddErrorLog("玩家[" + userName + "] GetFinishedDelegateBuyStoneOrders Exception", exc);
             return(null);
         }
     }
     else
     {
         throw new Exception();
     }
 }
        public int TakeRouletteAward(string token, string userName, int recordID, string info1, string info2)
        {
            if (RSAProvider.LoadRSA(token))
            {
                string currentUserName = ClientManager.GetClientUserName(token);
                if (currentUserName != userName)
                {
                    return(OperResult.RESULTCODE_USER_NOT_EXIST);
                }

                try
                {
                    return(RouletteAwardController.Instance.TakeAward(userName, recordID, info1, info2));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog(userName + " TakeRouletteAward Exception", exc);
                    return(OperResult.RESULTCODE_FALSE);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        public RouletteWinnerRecord[] GetAllWinAwardRecords(string token, string userName, int RouletteAwardItemID, MyDateTime BeginWinTime, MyDateTime EndWinTime, int IsGot, int IsPay, int pageItemCount, int pageIndex)
        {
            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    //string currentUserName = ClientManager.GetClientUserName(token);
                    //if (currentUserName != userName)
                    //{
                    //    return null;
                    //}

                    return(RouletteAwardController.Instance.GetAllPayWinAwardRecords(userName, RouletteAwardItemID, false, BeginWinTime, EndWinTime, IsGot, IsPay, pageItemCount, pageIndex));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("ServiceToClient.GetAllPayWinAwardRecords Exception.", exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
 public PlayerRaiderRoundHistoryRecordInfo[] GetPlayerRaiderRoundHistoryRecordInfo(string token, int pageItemCount, int pageIndex)
 {
     if (RSAProvider.LoadRSA(token))
     {
         string userName = "";
         try
         {
             userName = ClientManager.GetClientUserName(token);
             var player = PlayerController.Instance.GetPlayerInfoByUserName(userName);
             if (player == null)
             {
                 return(null);
             }
             return(DBProvider.GameRaiderofLostArkDBProvider.GetPlayerRaiderRoundHistoryRecordInfo(player.SimpleInfo.UserID, pageItemCount, pageIndex));
         }
         catch (Exception exc)
         {
             LogHelper.Instance.AddErrorLog("GetPlayerRaiderRoundHistoryRecordInfo Exception UserName: " + userName, exc);
             return(null);
         }
     }
     else
     {
         throw new Exception();
     }
 }
Example #16
0
        public int UpdateAddress(string token, PostAddress newAddress)
        {
            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    var playerUserName = ClientManager.GetClientUserName(token);
                    var player         = PlayerController.Instance.GetPlayerInfoByUserName(playerUserName);
                    if (player.SimpleInfo.UserID != newAddress.UserID)
                    {
                        return(OperResult.RESULTCODE_USER_NOT_EXIST);
                    }
                    return(DBProvider.UserDBProvider.UpdateAddress(newAddress));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("UpdateAddress Exception. ", exc);

                    return(OperResult.RESULTCODE_EXCEPTION);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        public PlayerBuyDiamondShoppingItemRecord[] GetPlayerBuyDiamondShoppingItemRecord(string token, int itemID, int shoppingStateInt, MyDateTime beginBuyTime, MyDateTime endBuyTime, int pageItemCount, int pageIndex)
        {
            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    string userName   = ClientManager.GetClientUserName(token);
                    var    playerInfo = PlayerController.Instance.GetPlayerInfoByUserName(userName);
                    if (playerInfo == null)
                    {
                        return(null);
                    }

                    return(DiamondShoppingController.Instance.GetPlayerBuyDiamondShoppingItemRecordByID(playerInfo.SimpleInfo.UserID, itemID, shoppingStateInt, beginBuyTime, endBuyTime, pageItemCount, pageIndex));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家 GetPlayerBuyDiamondShoppingItemRecord 异常. ClientIP=" + ClientManager.GetClientIP(token), exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Example #18
0
        /// <summary>
        /// -2表示参数无效,-1表示异常,0,表示不存在,1表示存在
        /// </summary>
        /// <param name="alipayAccount"></param>
        /// <param name="alipayRealName"></param>
        /// <returns></returns>
        public int CheckUserAlipayExist(string token, string alipayAccount, string alipayRealName)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    if (string.IsNullOrEmpty(alipayAccount) || string.IsNullOrEmpty(alipayRealName))
                    {
                        return(-2);
                    }
                    int result = PlayerController.Instance.CheckUserAlipayAccountExist(alipayAccount);
                    if (result == OperResult.RESULTCODE_TRUE)
                    {
                        return(result);
                    }
                    result = PlayerController.Instance.CheckUserAlipayRealNameExist(alipayRealName);
                    return(result);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("CheckUserAlipayExist Exception. alipayAccount: " + alipayAccount
                                                   + ", alipayRealName: " + alipayRealName, exc);

                    return(-1);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Example #19
0
        public AgentUserInfo GetAgentUserInfo(string token, string userName)
        {
            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    var playerInfo = PlayerController.Instance.GetPlayerInfoByUserName(userName);
                    if (playerInfo == null)
                    {
                        return(null);
                    }

                    return(DBProvider.AgentUserInfoDBProvider.GetAgentUserInfo(playerInfo));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("GetAgentUserInfo Exception. userName: " + userName, exc);

                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Example #20
0
        public PlayerInfo GetPlayerInfo(string token)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    string     userName = ClientManager.GetClientUserName(token);
                    PlayerInfo user     = PlayerController.Instance.GetPlayerInfoByUserName(userName);
                    return(user);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("GetPlayerInfo", exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Example #21
0
        public int ChangePlayerSimpleInfo(string token, string alipayAccount, string alipayRealName, string IDCardNo, string email, string qq)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    if (string.IsNullOrEmpty(alipayAccount) || string.IsNullOrEmpty(alipayRealName))
                    {
                        return(OperResult.RESULTCODE_PARAM_INVALID);
                    }
                    string userName = ClientManager.GetClientUserName(token);
                    int    value    = PlayerController.Instance.ChangePlayerSimpleInfo(userName, alipayAccount, alipayRealName, IDCardNo, email, qq);
                    if (value == OperResult.RESULTCODE_TRUE)
                    {
                        LogHelper.Instance.AddInfoLog("玩家[" + userName + "]修改了用户信息,修改后支付宝账户为:" + alipayAccount + ",实名为:" + alipayRealName + ",邮箱为:" + email + ", QQ为:" + qq);
                    }

                    return(value);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("ChangePlayerSimpleInfo", exc);
                    return(OperResult.RESULTCODE_FALSE);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Example #22
0
        /// <summary>
        /// RESULTCODE_USER_NOT_EXIST; RESULTCODE_FALSE
        /// </summary>
        /// <param name="token"></param>
        /// <param name="userName"></param>
        /// <param name="minersCount"></param>
        /// <returns></returns>
        public int BuyMiner(string token, string userName, int minersCount)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    if (minersCount <= 0)
                    {
                        return(OperResult.RESULTCODE_FALSE);
                    }

                    if (ClientManager.GetClientUserName(token) != userName)
                    {
                        return(OperResult.RESULTCODE_USER_NOT_EXIST);
                    }

                    return(PlayerController.Instance.BuyMiner(userName, minersCount));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 购买矿工异常,购买矿工数为:" + minersCount, exc);
                    return(OperResult.RESULTCODE_EXCEPTION);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Example #23
0
        public TradeOperResult BuyMine(string token, string userName, int minesCount, int payType)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    TradeOperResult result = new TradeOperResult();
                    result.PayType = payType;
                    if (minesCount <= 0)
                    {
                        return(result);
                    }

                    return(OrderController.Instance.MineOrderController.BuyMine(userName, minesCount, payType));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 购买矿山异常,购买矿山数为:" + minesCount + ",支付类型为:" + ((PayType)payType).ToString(), exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Example #24
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="token"></param>
        /// <param name="userName"></param>
        /// <param name="stones">-1表示清空临时产出</param>
        /// <returns></returns>
        public int GatherStones(string token, string userName, decimal stones)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    if (ClientManager.GetClientUserName(token) != userName)
                    {
                        return(OperResult.RESULTCODE_USER_NOT_EXIST);
                    }
                    if (stones == 0)
                    {
                        return(OperResult.RESULTCODE_LACK_OF_BALANCE);
                    }
                    GatherTempOutputStoneResult result = PlayerController.Instance.GatherStones(userName, stones);
                    return(result.OperResult);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 收取矿石异常,矿石数为:" + stones, exc);
                    return(OperResult.RESULTCODE_EXCEPTION);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Example #25
0
        public MakeAVowToGodResult MakeAVowToGod(string token, string userName)
        {
            if (RSAProvider.LoadRSA(token))
            {
                MakeAVowToGodResult result = new MakeAVowToGodResult();

                try
                {
                    if (ClientManager.GetClientUserName(token) != userName)
                    {
                        result.OperResultCode = OperResult.RESULTCODE_USER_NOT_EXIST;
                        return(result);
                    }
                    result = PlayerController.Instance.MakeAVowToGod(userName);
                    return(result);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 神灵许愿异常", exc);
                    result.OperResultCode = OperResult.RESULTCODE_EXCEPTION;
                    return(result);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Example #26
0
        public TradeOperResult GoldCoinRecharge(string token, string userName, int goldCoinCount, int payType)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    TradeOperResult result = new TradeOperResult();
                    result.PayType   = payType;
                    result.TradeType = (int)AlipayTradeInType.BuyGoldCoin;

                    if (ClientManager.GetClientUserName(token) != userName)
                    {
                        result.ResultCode = OperResult.RESULTCODE_USER_NOT_EXIST;
                    }

                    int valueRMB = (int)Math.Ceiling(goldCoinCount / GlobalConfig.GameConfig.RMB_GoldCoin);
                    return(OrderController.Instance.GoldCoinOrderController.RechargeGoldCoin(userName, valueRMB, goldCoinCount, payType));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 金币充值异常,充值金币数为:" + goldCoinCount + ",支付类型为:" + ((PayType)payType).ToString(), exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        public NoticeInfo[] GetNotices(string token, int year, int month, int day, int hour, int minute, int second)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    return(NoticeController.Instance.GetAllNotices());
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("GetNotices Exception. ClientIP=" + ClientManager.GetClientIP(token)
                                                   + ", year=" + year.ToString() + ", month=" + month.ToString() + ", day=" + day.ToString()
                                                   + ", hour=" + hour.ToString() + ", minute=" + minute.ToString() + ", second=" + second.ToString(),
                                                   exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        public MetaData.Game.Roulette.RouletteWinAwardResult StartRoulette(string token, string userName)
        {
            if (RSAProvider.LoadRSA(token))
            {
                string currentUserName = ClientManager.GetClientUserName(token);
                if (currentUserName != userName)
                {
                    return(null);
                }

                try
                {
                    return(RouletteAwardController.Instance.Start(userName));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog(userName + " StartRoulette Exception", exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Example #29
0
        public CallbackInfo Callback(string token)
        {
            if (RSAProvider.LoadRSA(token))
            {
                bool valid = false;
                Queue <CallbackInfo> queue = null;
                DateTime             start = DateTime.Now;
                while (!valid)
                {
                    if (!App.ServiceToRun.IsStarted)
                    {
                        throw new Exception();
                    }

                    lock (this._callbackDicLocker)
                    {
                        if (this._callbackDic.TryGetValue(token, out queue))
                        {
                            lock (queue)
                            {
                                valid = queue.Count > 0;
                            }
                        }
                        else
                        {
                            throw new Exception();
                        }
                    }

                    if (!valid)
                    {
                        if ((DateTime.Now - start).TotalSeconds >= GlobalData.KeepAliveTimeSeconds)
                        {
                            return(new CallbackInfo()
                            {
                                MethodName = String.Empty
                            });
                        }

                        Thread.Sleep(100);
                    }
                }

                if (!valid)
                {
                    throw new Exception();
                }

                lock (queue)
                {
                    return(queue.Dequeue());
                }
            }
            else
            {
                throw new Exception();
            }
        }
Example #30
0
        public int CancelDelegateBuyStone(string token, MetaData.Game.StoneStack.StoneDelegateBuyOrderInfo buyOrder)
        {
            if (RSAProvider.LoadRSA(token))
            {
                string userName = "";
                try
                {
                    userName = ClientManager.GetClientUserName(token);
                    var playerRunner = PlayerController.Instance.GetRunnable(userName);
                    if (playerRunner == null)
                    {
                        return(OperResult.RESULTCODE_USER_NOT_EXIST);
                    }

                    StoneDelegateBuyOrderInfo canceledBuyOrder = null;
                    CustomerMySqlTransaction  myTrans          = MyDBHelper.Instance.CreateTrans();
                    try
                    {
                        var resultObj = OrderController.Instance.StoneStackController.PlayerCancelBuyStone(buyOrder.OrderNumber, buyOrder.BuyUnit.Price, myTrans, out canceledBuyOrder);
                        if (resultObj.OperResultCode != OperResult.RESULTCODE_TRUE)
                        {
                            return(resultObj.OperResultCode);
                        }
                        if (canceledBuyOrder == null)
                        {
                            return(OperResult.RESULTCODE_FALSE);
                        }
                        playerRunner.CancelDelegateBuyStoneOrder(canceledBuyOrder, myTrans);

                        myTrans.Commit();

                        LogHelper.Instance.AddInfoLog("玩家[" + userName + "], 撤消矿石委托买单。Order: " + canceledBuyOrder.ToString());
                        return(OperResult.RESULTCODE_TRUE);
                    }
                    catch (Exception exc)
                    {
                        myTrans.Rollback();
                        string errorMsg = "ServiceToClient.CancelDelegateBuyStone Exception userName: "******", buyOrder : " + buyOrder.ToString();
                        LogHelper.Instance.AddErrorLog(errorMsg, exc);
                        return(OperResult.RESULTCODE_FALSE);
                    }
                    finally
                    {
                        myTrans.Dispose();
                    }
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] DelegateSellStone Exception", exc);
                    return(OperResult.RESULTCODE_EXCEPTION);
                }
            }
            else
            {
                throw new Exception();
            }
        }