Exemple #1
0
 /// <summary>
 /// 自动分配 3个人 到一桌  1.玩家进入房间触发。2.系统增加机器人触发
 /// 分配机器人也在这儿处理
 /// </summary>
 /// <returns></returns>
 private int AutoAlloctoTable(TCUser tempU, int _tid, cs_enterroom _data)
 {
     lock (objLock)
     {
         TCTable _bftable;
         if (DicTable.TryGetValue(_tid, out _bftable))
         {//已存在流程是错误的
             ErrorRecord.Record("fetal error 201601101429TC 必须处理 ");
             return(-1);
         }
         List <TCUser> _tempfirstUser = new List <TCUser>();
         _tempfirstUser.Add(tempU);
         TCTable tab        = new TCTable(_gameid, _roomid, _tid, _tempfirstUser, _data);
         int     _checkCode = tab.CheckRoomCard(tempU._userid);
         if (_checkCode != 1)
         {
             return(_checkCode);
         }
         for (int i = 0; i < _tempfirstUser.Count; i++)
         {                         //移出已经分配了的用户
             TCUser temp02 = null; // new BullFightUser();
             DicUser.TryRemove(_tempfirstUser[i]._userid, out temp02);
         }
         //添加到当前桌子列表,以便打牌过程好使用
         if (!DicTable.TryAdd(_tid, tab))
         {
             ErrorRecord.Record("add _tableid fial maybe have exist... 201208241601TC");
         }
         return(1);
     }
 }
        /// <summary>
        /// 自动2000000 机器人创建一个桌子唯一桌子,系统奖池也是用的这个ID
        /// </summary>
        /// <returns></returns>
        public int CreateTableByRobot( )
        {
            lock (objLock)
            {
                if (GMService.isStop)
                {
                    return(0);
                }
                BullColorRoom roomData;
                roomCache.TryGet(RoomId + "", out roomData);
                if (roomData == null)
                {
                    return(0);
                }


                int _tid = 0;
                //只有一个桌子 所有不用生产桌子
                if (!unusedTableQue.TryDequeue(out _tid))
                {
                    ErrorRecord.Record("201704011350BFC unusedQue.Count <= 0   桌子不够了,,只是能等待排队...");
                    DicUser = new ConcurrentDictionary <int, BullColorUser>();
                    return(0);
                }
                tb_User tbuser = tb_UserEx.GetFromCachebyUserID(2000000);
                if (tbuser == null)
                {
                    ErrorRecord.Record("没有特殊机器人了系 统不能开始牛牛时时彩");
                    return(0);
                }

                BullColorUser tempU = new BullColorUser();
                tempU.Initi(tbuser.UserID + "", RoomId, tbuser, true);              // 当成客户端 的IP:Port用
                roomData.EnterRoomBase(tempU._tbUser.UserID, _currRoomInfo.gameid); //处理状态的,不然一直找不到用户
                cs_enterroom _data = new cs_enterroom()
                {
                    baserate = _currRoomInfo.Baserate, gametype = _currRoomInfo.gametype, gameid = 4, gamemodel = 2, levelid = RoomId, numpertable = 500, roomcard = 0, rankertype = 1, tableCount = 1
                };
                List <BullColorUser> _tempfirstUser = new List <BullColorUser>();
                _tempfirstUser.Add(tempU);

                BullColorTable tab = new BullColorTable(_currRoomInfo.gameid, this, _tid, _tempfirstUser, _data);
                //添加到当前桌子列表,以便打牌过程好使用
                if (!DicTable.TryAdd(_tid, tab))
                {
                    ErrorRecord.Record("add _tableid fial maybe have exist... 201208241601BF");
                }
                return(_tid);
            }
        }
        /// <summary>
        ///  用户登录房间时调用
        /// </summary>
        /// <param name="roomID"></param>
        /// <param name="UserID"></param>
        /// <param name="ipport"></param>
        /// <returns></returns>
        public int EnterRoom(cs_enterroom _data, int UserID, string ipport)
        {
            lock (objLock)
            {
                if (GMService.isStop)
                {
                    return(-99);
                }
                BullColorRoom roomData;
                if (!roomCache.TryGet(RoomId + "", out roomData))
                {
                    return(-99);
                }

                roomData.EnterRoomBase(UserID, _data.gameid);
                tb_User tbuser = tb_UserEx.GetFromCachebyUserID(UserID);
                if (tbuser == null)
                {
                    ErrorRecord.Record("201208241558BF tbuser == null  userID:" + UserID);
                    return(0);
                }

                if (tbuser.UserMoney > _currRoomInfo._max || tbuser.UserMoney < _currRoomInfo._min)
                {
                    return(-99);
                }

                UserStatus _us = BaseLobby.instanceBase.GetUserStatusbyUserID(UserID);
                if (_us != null)
                {
                    if (_us.Status == UserStatusEnum.InTableDaiPai || _us.Status == UserStatusEnum.InTableDaiPaiDis || _us.Status == UserStatusEnum.InTableWaiting)
                    {
                        return(-1);
                    }
                }
                BullColorUser tempU = new BullColorUser();
                tempU.Initi(ipport, RoomId, tbuser, false);// 当成客户端 的IP:Port用

                if (!DicUser.TryAdd(UserID, tempU))
                {
                    ErrorRecord.Record("201208241155BF 已经存在ROOM内了, 添加不成功 逻辑需要处理");
                }
                BullColorTable _findtable = GetEmptyPosTable();
                if (_findtable != null)
                {
                    return(DicUser.Count); //直接进入 空桌子
                }
                return(DicUser.Count);     //金币模式 等5秒再一起分配
            }
        }
        /// <summary>
        /// 一桌最大支持500个人。
        /// </summary>
        /// <param name="_data"></param>
        public void InitiArgs(cs_enterroom _data)
        {
            if (_data.rankertype < 1 || _data.rankertype > 2)
            {
                return;
            }
            _gametype       = 2;
            _gameCoin2Room1 = 2;
            _baseMoney      = _data.baserate;
            _rankertype     = BFRankerEnum.TurnFixed;
            _minLimit       = 1;
            _maxLimit       = 500;

            _maxTableOverCount = 1;// _data.tableCount;
            //_baseallmoney = 200;//测试数据
            _curTableOverCount = 1;
            _gambleCountLimit  = 50;//限制50次单次最大的下注次数
        }
Exemple #5
0
        /// <summary>
        ///  用户登录房间时调用
        /// </summary>
        /// <param name="roomID"></param>
        /// <param name="_UserID"></param>
        /// <param name="ipport"></param>
        /// <returns></returns>
        public int EnterRoom(cs_enterroom _data, int UserID, string ipport)
        {
            lock (objLock)
            {
                base.EnterRoomBase(UserID, _data.gameid);
                tb_User tbuser = tb_UserEx.GetFromCachebyUserID(UserID);
                if (tbuser == null)
                {
                    ErrorRecord.Record("201208241558TC tbuser == null  userID:" + UserID);
                    return(0);
                }
                UserStatus _us = BaseLobby.instanceBase.GetUserStatusbyUserID(UserID);
                if (_us != null)
                {
                    if (_us.Status == UserStatusEnum.InTableDaiPai || _us.Status == UserStatusEnum.InTableDaiPaiDis || _us.Status == UserStatusEnum.InTableWaiting)
                    {
                        return(-1);
                    }
                }
                TCUser tempU = new TCUser();
                tempU.Initi(ipport, mRoomID, tbuser, false);   // 当成客户端 的IP:Port用

                if (!DicUser.TryAdd(UserID, tempU))
                {
                    ErrorRecord.Record("201208241155TC  已经存在ROOM内了, 添加不成功");
                }
                TCTable _findtable = GetEmptyPosTable();
                if (_findtable != null)
                {
                    ////_findtable.AllocationtoTable(DicUser[UserID]);
                    ////BullFightUser temp02 = null;// new BullFightUser();
                    ////DicUser.TryRemove(UserID, out temp02);
                    ////return 1;//直接进入 空桌子  //开房模式不要这个功能了,
                }
                int _tableid = 0;
                if (!unusedTableQue.TryDequeue(out _tableid))
                {
                    ErrorRecord.Record("201611141831TC unusedQue.Count <= 0   桌子不够了,,只是能等待排队...");
                    return(999);
                }
                return(AutoAlloctoTable(tempU, _tableid, _data));
                //return DicUser.Count;
            }
        }
Exemple #6
0
        /// <summary>
        ///  用户登录房间时调用
        /// </summary>
        /// <param name="roomID"></param>
        /// <param name="UserID"></param>
        /// <param name="ipport"></param>
        /// <returns></returns>
        public int EnterRoom(cs_enterroom _data, int UserID, string ipport)
        {
            lock (objLock)
            {
                if (GMService.isStop)
                {
                    return(-99);
                }
                base.EnterRoomBase(UserID, _data.gameid);

                tb_User tbuser = tb_UserEx.GetFromCachebyUserID(UserID);
                if (tbuser == null)
                {
                    ErrorRecord.Record("201208241558BF tbuser == null  userID:" + UserID);
                    return(0);
                }

                if (tbuser.UserMoney > _currRoomInfo._max || tbuser.UserMoney < _currRoomInfo._min)
                {
                    return(-99);
                }

                UserStatus _us = BaseLobby.instanceBase.GetUserStatusbyUserID(UserID);
                if (_us != null)
                {
                    if (_us.Status == UserStatusEnum.InTableDaiPai || _us.Status == UserStatusEnum.InTableDaiPaiDis || _us.Status == UserStatusEnum.InTableWaiting)
                    {
                        return(-1);
                    }
                }
                BullFight100User tempU = new BullFight100User();
                tempU.Initi(ipport, mRoomID, tbuser, false);// 当成客户端 的IP:Port用

                ////if (!DicUser.TryAdd(UserID, tempU)) ErrorRecord.Record("201208241155BF 已经存在ROOM内了, 添加不成功 逻辑需要处理");
                if (!DicUser.ContainsKey(UserID))
                {
                    DicUser.TryAdd(UserID, tempU);
                }

                return(DicUser.Count);//直接进入 空桌子
            }
        }
        /// <summary>
        /// 进入房间 返回现在等待用户数
        /// </summary>
        /// <returns></returns>
        public string EnterRoom(tb_User _user, cs_enterroom _data)
        {
            sc_enterroom _senddata = new sc_enterroom()
            {
                result = 0, fn = "sc_enterroom", cc = 0
            };
            TCRoom room = TCLobby.instance.GetRoomByRoomID(_data.levelid);

            if (room == null)
            {
                return(JsonUtils.Serialize(_senddata));
            }
            int WaitUserCount = room.EnterRoom(_data, _user.UserID, _strIPandPort);

            _senddata.waitcount = WaitUserCount;
            _senddata.result    = 1;
            _senddata.gameid    = _data.gameid;
            _senddata.levelid   = _data.levelid;
            return(JsonUtils.Serialize(_senddata));
        }
        /// <summary>
        /// 进入房间 返回现在等待用户数
        /// </summary>
        /// <returns></returns>
        public string EnterRoom(tb_User _user, cs_enterroom _data)
        {
            if (_data.levelid == 0)
            {
                ErrorRecord.Record("cs_enterroom _data.levelid == 0...");
                return("");
            }
            switch (_data.gameid)
            {
            case 42:
                return(_bf100logic.EnterRoom(_user, _data));

            case 41:
                return(_tclogic.EnterRoom(_user, _data));

            default:
                break;
            }
            return("");
        }
Exemple #9
0
        /// <summary>
        /// 进入三个人后处理的
        /// </summary>
        /// <param name="tablenum"></param>
        /// <param name="userList"></param>
        public TCTable(int gameid, int roomid, int tablenum, List <TCUser> userList, cs_enterroom _data)
        {
            lock (objLock)
            {
                _numpertable = userList.Count;
                _roomid      = roomid;
                _tableid     = tablenum;
                _baseMoney   = 1;
                _bankpos     = 1;

                _allTurnCount     = _numpertable * 20;
                _currentTurnCount = 0;
                if (_DicPos2User == null)
                {
                    _DicPos2User = new ConcurrentDictionary <int, TCUser>();
                }

                List <TCUser> _fuserlist = new List <TCUser>(userList);
                ConcurrentDictionary <int, BaseUser> _temppos2user = new ConcurrentDictionary <int, BaseUser>();
                for (int i = 0; i < _fuserlist.Count; i++)
                {
                    _fuserlist[i]._tableID = tablenum;         //赋值桌子号

                    _DicPos2User.TryAdd(i + 1, _fuserlist[i]); //1~3表示位置
                    _temppos2user.Add(i + 1, _fuserlist[i]);
                }
                _judge = new TCJudge(this);
                _judge.InitiArgs(_data);
                base._gametype = _judge._gametype;
                _tableMaxCount = _judge.GetTableorBankerMaxCount;

                ForeashAllDo((i) =>
                {
                    _DicPos2User[i]._CurrentGold = _judge.BaseAllMoney;   //初始化底分。
                });

                base.Initi(_temppos2user, _judge._minLimit, _judge._maxLimit, gameid, TCSendDataServer.instance, DoTableTimer);
                base.EnterTable();
            }
        }
Exemple #10
0
        public void InitiArgs(cs_enterroom _data)
        {
            if (_data.rankertype < 1 || _data.rankertype > 2)
            {
                return;
            }
            if (_data.numpertable < 2 || _data.numpertable > 4)
            {
                return;
            }
            _gametype = _data.gametype;


            _roomcard          = _data.roomcard;
            _minLimit          = _data.numpertable;
            _maxLimit          = _data.numpertable;
            _maxTableOverCount = _data.tableCount;
            _maxTableOverCount = 3;   //测试
            _baseallmoney      = 200; //测试数据

            _curTableOverCount = 0;
        }
Exemple #11
0
        public void InitiArgs(cs_enterroom _data)
        {
            if (_data.rankertype < 1 || _data.rankertype > 2)
            {
                return;
            }
            if (_data.numpertable < 2 || _data.numpertable > 500)
            {
                return;
            }
            _gametype       = _data.gametype;
            _gameCoin2Room1 = _data.gamemodel;
            _baseMoney      = _data.baserate;
            _rankertype     = BFRankerEnum.TurnFixed;

            _roomcard          = 0;// _data.roomcard;
            _minLimit          = 2;
            _maxLimit          = _data.numpertable;
            _maxTableOverCount = 100000;// _data.tableCount;

            //_baseallmoney = 200;//测试数据
            _curTableOverCount = 0;
        }
Exemple #12
0
        /// <summary>
        /// 自动分配 3个人 到一桌  1.玩家进入房间触发。2.系统增加机器人触发
        /// 分配机器人也在这儿处理
        /// </summary>
        /// <returns></returns>
        private int CreateTableByHuman(BullFight100User tempU, int _tid, cs_enterroom _data)
        {
            lock (objLock)
            {
                ////if (GMService.isStop)
                ////    return -1;
                ////BullFight100Table _bftable;
                ////if (DicTable.TryGetValue(_tid, out _bftable))
                ////{//已存在流程是错误的
                ////    ErrorRecord.Record("fetal error 201601101429BF 必须处理 ");
                ////    return -1;
                ////}
                ////BullFight100Table tab = new BullFight100Table(_gameid, this, _tid, tempU, _data);
                ////int _checkCode = tab.CheckRoomCard(tempU._userid);
                ////if (_checkCode != 1) return _checkCode;
                ////  //移出已经分配了的用户
                ////    BullFight100User temp02 = null;// new BullFightUser();
                ////    DicUser.TryRemove(tempU._userid, out temp02);

                //////添加到当前桌子列表,以便打牌过程好使用
                ////if (!DicTable.TryAdd(_tid, tab)) ErrorRecord.Record("add _tableid fial maybe have exist... 201208241601BF");
                return(1);
            }
        }
        /// <summary>
        /// 进入1~1006人后处理的
        /// </summary>
        /// <param name="tablenum"></param>
        /// <param name="userList"></param>
        public BullColorTable(int gameid, BullColorRoom _room2, int tablenum, List <BullColorUser> userList, cs_enterroom _data)
        {
            _numpertable = userList.Count;
            _roomid      = _room2.RoomId;
            _room        = _room2 as BullColorRoom;
            _tableid     = tablenum;
            _baseMoney   = 1;
            _bankpos     = 1;
            if (_DicPos2User == null)
            {
                _DicPos2User = new ConcurrentDictionary <int, BullColorUser>();
            }

            List <BullColorUser> _fuserlist = new List <BullColorUser>(userList);
            ConcurrentDictionary <int, BaseUser> _temppos2user = new ConcurrentDictionary <int, BaseUser>();

            for (int i = 0; i < _fuserlist.Count; i++)
            {
                _fuserlist[i]._tableID = tablenum;         //赋值桌子号

                _DicPos2User.TryAdd(i + 1, _fuserlist[i]); //1~3表示位置
                _temppos2user.TryAdd(i + 1, _fuserlist[i]);
            }

            _judge = new BullColorJudge(this);
            _judge.InitiArgs(_data);
            base._gametype = _judge._gametype;
            _tableMaxCount = _judge.GetTableorBankerMaxCount;

            _TurnWaitTime = BFColorSendDataServer.instance.TurnWaitTime;

            base.Initi(_temppos2user, _judge._minLimit, _judge._maxLimit, gameid, BFColorSendDataServer.instance, DoTableTimer);
            base.EnterTable();
            _DicPos2User[_bankpos].SetTimeOutAction(1, "sc_ready_bfc_n", 1 * 60);//1分钟等待时间
            _strStatus = "BullColorTable...1";
        }
        /// <summary>
        ///
        /// 进入2~6人后处理的
        /// </summary>
        /// <param name="tablenum"></param>
        /// <param name="userList"></param>
        public BullFight100Table(int gameid, BaseRoom _room2, int tablenum, BullFight100User _firstUser, cs_enterroom _data)
        {
            _numpertable = 1;
            _roomid      = _room2.mRoomID;
            _room        = _room2 as BullFight100Room;
            _tableid     = tablenum;
            _baseMoney   = 1;
            _bankpos     = 1;
            if (_DicPos2User == null)
            {
                _DicPos2User = new ConcurrentDictionary <int, BullFight100User>();
            }
            ConcurrentDictionary <int, BaseUser> _temppos2user = new ConcurrentDictionary <int, BaseUser>();

            _quePosGetBanker = new ConcurrentQueue <int>();
            _quePosGetBanker.Enqueue(_bankpos); //================测试数据
            _firstUser._tableID = tablenum;     //赋值桌子号

            _DicPos2User.TryAdd(1, _firstUser); //1~3表示位置
            _temppos2user.TryAdd(1, _firstUser);
            _masterPos = 1;                     //房主,只做建房用

            _judge = new BullFight100Judge(this);
            _judge.InitiArgs(_data);
            base._gametype = _judge._gametype;
            _tableMaxCount = _judge.GetTableorBankerMaxCount;

            _TurnWaitTime = 15;

            base.Initi(_temppos2user, _judge._minLimit, _judge._maxLimit, gameid, BF100SendDataServer.instance, DoTableTimer);
            base.EnterTable();

            _strStatus = "BullFightTable...1";
        }
        /// <summary>
        /// 处理消息
        /// </summary>
        /// <param name="clientcommand"></param>
        /// <returns></returns>
        public bool DealDataEx(string _data, string _ipport, int SessionUserID, out string senddata)
        {
            senddata = "";
            if (SessionUserID == 0)
            {
                sc_exit_rebindsession_n _rebind = new sc_exit_rebindsession_n()
                {
                    result = 1, fn = "sc_exit_rebindsession_n"
                };
                senddata = JsonUtils.Serialize(_rebind);
                return(true);
            }
            _strIPandPort = _ipport;
            cs_base _basedata = JsonUtils.Deserialize <cs_base>(_data);
            var     cacheSet  = new PersonalCacheStruct <tb_User>();
            tb_User _tempuser = cacheSet.FindKey(SessionUserID.ToString());

            if (cacheSet.Count == 0 || _tempuser == null)
            {
                SchemaTable    schema   = EntitySchemaSet.Get <tb_User>();
                DbBaseProvider provider = DbConnectionProvider.CreateDbProvider(schema);
                DbDataFilter   filter   = new DbDataFilter(0);
                filter.Condition = provider.FormatFilterParam("UserId");
                filter.Parameters.Add("UserId", SessionUserID);
                cacheSet.TryRecoverFromDb(filter);                      //从数据库中恢复数据
                ////cacheSet.TryRecoverFromDb(new DbDataFilter(0));//all
                _tempuser = cacheSet.FindKey(SessionUserID.ToString()); //
            }
            if (_tempuser == null)
            {
                ErrorRecord.Record("CommonLogic 201611051736 User数据找不到SessionUserID:" + SessionUserID);
                return(false);
            }
            lock (_lockObj)
            {
                try
                {
                    switch (_basedata.fn)
                    {
                    case "cs_base": break;

                    case "cs_login":    //登录
                        cs_login _login = JsonUtils.Deserialize <cs_login>(_data);
                        senddata = Login(_tempuser, _login.accountId);
                        break;

                    case "cs_getgamelist":     //获取游戏列表
                        cs_getgamelist _gamelist = JsonUtils.Deserialize <cs_getgamelist>(_data);
                        senddata = GetGameList(_tempuser);
                        break;

                    case "cs_getgamelevel":     //获取游戏列表   也是房间列表
                        cs_getgamelevel _levellist = JsonUtils.Deserialize <cs_getgamelevel>(_data);
                        senddata = GetLevelList(_tempuser, _levellist.gameid);
                        break;

                    case "cs_freshplayerInfoSD":     //获取玩家信息
                        senddata = GetCurrentPlayerInfoSD(_tempuser);
                        break;

                    case "cs_enterroom":     //进入指定房间
                        cs_enterroom _enterroom = JsonUtils.Deserialize <cs_enterroom>(_data);
                        senddata = EnterRoom(_tempuser, _enterroom);
                        break;

                    case "cs_enterroomtable":     //进入指定房间
                        cs_enterroomtable _enterroomtable = JsonUtils.Deserialize <cs_enterroomtable>(_data);
                        senddata = EnterRoomTable(_tempuser, _enterroomtable);
                        break;

                    case "cs_exitroom":     //退出指定房间
                        cs_exitroom _exitroom = JsonUtils.Deserialize <cs_exitroom>(_data);
                        senddata = ExitRoom(_tempuser, _exitroom);
                        break;

                    case "cs_applyexittable":
                        cs_applyexittable _exittable = JsonUtils.Deserialize <cs_applyexittable>(_data);
                        senddata = ApplyExitTable(_tempuser, _exittable);
                        break;

                    case "cs_dealexittable":
                        cs_dealexittable _dealexittable = JsonUtils.Deserialize <cs_dealexittable>(_data);
                        senddata = DealExitTable(_tempuser, _dealexittable);
                        break;

                    case "cs_getnotice":    // 请求当前公告
                        cs_getnotice _notice = JsonUtils.Deserialize <cs_getnotice>(_data);
                        senddata = GetNotice("");
                        break;

                    case "cs_chat":    // 发送聊天信息
                        cs_chat _chat = JsonUtils.Deserialize <cs_chat>(_data);
                        senddata = NotifyChat(_tempuser, _chat);
                        break;

                    case "cs_gm_chesscard":        //GM 操作
                        break;

                    case "cs_reenterroom":     //断线重连第一版
                        cs_reenterroom _reroom = JsonUtils.Deserialize <cs_reenterroom>(_data);
                        senddata = ReEnterRoom(_tempuser, _reroom);
                        break;

                    case "cs_ping":    //GetPing  //给请求方发送服务器时间
                        senddata = GetPing();
                        break;

                    case "cs_getranklist":     //获取排行榜列表
                        cs_getranklist _getrank = JsonUtils.Deserialize <cs_getranklist>(_data);
                        senddata = GetRankList(_tempuser, _getrank);
                        break;

                    case "cs_getcombatgainlist":     //获取排行榜列表
                        cs_getcombatgainlist _getcombatgain = JsonUtils.Deserialize <cs_getcombatgainlist>(_data);
                        senddata = GetCombatGainList(_tempuser, _getcombatgain);
                        break;

                    case "cs_feedback":
                        cs_feedback _feedback = JsonUtils.Deserialize <cs_feedback>(_data);
                        senddata = PostFeedback(_tempuser, _feedback);
                        break;

                    case "cs_askmoneytrading":    //索要赠送请求
                        cs_askmoneytrading data = JsonUtils.Deserialize <cs_askmoneytrading>(_data);
                        //如果是作弊账号则走单独处理流程
                        HandelType type;
                        type = _tempuser.winpercent > 0 ? HandelType.abnormal : HandelType.normal;
                        var handleGoldOper = CreateHandleGoldFactory.CreateHandleGoldOperation(type);
                        handleGoldOper.model = data;
                        handleGoldOper.user  = _tempuser;
                        senddata             = handleGoldOper.Operation();
                        break;

                    case "cs_ensuremoneytrading":    //确认接收赠送金币
                        cs_ensuremoneytrading data1 = JsonUtils.Deserialize <cs_ensuremoneytrading>(_data);
                        senddata = EnsureMoneyTrading(_tempuser, data1);
                        break;

                    default:
                        if (_basedata.fn.EndsWith("_bf100"))
                        {
                            senddata = _bf100logic.DealDataEx(_data, _ipport, _tempuser);
                        }
                        else if (_basedata.fn.EndsWith("_bfc"))
                        {
                            senddata = _tclogic.DealDataEx(_data, _ipport, _tempuser);
                        }
                        //else if (_basedata.fn.EndsWith("_tc"))
                        //{ senddata = _tclogic.DealDataEx(_data, _ipport, _tempuser); }
                        break;
                    }
                    return(true);
                }
                catch (Exception ex)
                {
                    ErrorRecord.Record(ex, " 201206091508 ");
                    return(false);
                }
            }
        }
Exemple #16
0
        /// <summary>
        /// 执行指令 格式 "001|1,2,3"
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        public string DoExecCmd(string address, string json)
        {
            TraceLog.WriteInfo("{0}执行指令:{1}", address, json);
            cs_base_gm _basegm = null;

            try
            {
                _basegm = JsonUtils.Deserialize <cs_base_gm>(json);
            }
            catch (Exception ex)
            {
                return("0");
            }
            string errorCode = "0";

            switch (_basegm.fn)
            {
            case "0001":    //通知所有玩家 ?CMD=0001|玩家1524879,获得了以排行榜一等级奖!
                //sc_getnotice_n _getnotice = new sc_getnotice_n() { result = 1, fn = "_getnotice", noticelist = new List<string>() };
                //_getnotice.noticelist.Add(cmds[1]);
                //BaseSendDataServer.AutoNotifySendData(JsonUtils.Serialize((_getnotice)));
                errorCode = "1";
                break;

            case "0002":    //踢出游戏 ?CMD=0002|1524879

                errorCode = "1";
                break;

            case "0003":    //充值 ?CMD=0002|1524879|5000


                //int userId = 0;
                //int diamond = 0;
                //if(int.TryParse(cmds[1],out userId) && int.TryParse(cmds[2],out diamond))
                //{
                //    var user = tb_UserEx.GetFromCachebyUserID(userId);
                //    if(user != null)
                //    {
                //        user.ModifyLocked(() =>
                //            {
                //                user.diamond += diamond;
                //            });
                //    }
                //    errorCode = "1";
                //}
                break;

            case "0004":    //设置指定玩家的当前分数     ?CMD=0004|1380162|99     http://127.0.0.1:8080/Service/?CMD=0004|2000001|-9999|4
                //if (cmds.Length != 4) break;
                //int _userId004 = 0;
                //int _money = 0;
                //int _gameid = 0;
                //if (int.TryParse(cmds[1], out _userId004) && int.TryParse(cmds[2], out _money) && int.TryParse(cmds[3], out _gameid))
                //{
                //    if (_gameid == BullFightLobby.instance.Gameid)
                //    {
                //        //只修改内存数据,不做持久化
                //        UserStatus _us = BullFightLobby.instance.GetUserStatusbyUserID(_userId004);
                //        if (_us == null) break;
                //        BullFightTable _bftable = BullFightLobby.instance.GetTableByRoomIDandTableID(_us.RoomID, _us.TableID);
                //        if (_bftable == null) break;


                //        BullFightUser _bfuser = _bftable.GetUserByID(_userId004);
                //        if (_bfuser == null) break;
                //        _bfuser._moneyaddorreduce = _money;
                //        //_bfuser.UpdateMoney(99);            被覆盖了,无效
                //        errorCode = "1";
                //    }
                //    else if (_gameid == LandLordLobby.instance.Gameid)
                //    {   //只修改内存数据,不做持久化
                //        UserStatus _us = LandLordLobby.instance.GetUserStatusbyUserID(_userId004);
                //        if (_us == null) break;
                //        LandLordTable _bftable = LandLordLobby.instance.GetTableByRoomIDandTableID(_us.RoomID, _us.TableID);
                //        if (_bftable == null) break;


                //        LandLordUser _bfuser = _bftable.GetUserByID(_userId004);
                //        if (_bfuser == null) break;
                //        _bfuser._moneyaddorreduce = _money;
                //        //_bfuser.UpdateMoney(99);            被覆盖了,无效
                //        errorCode = "1";
                //    }
                //}
                break;

            case "0005":    //设置指定玩家申请解散游戏     ?CMD=0005|1380162     http://127.0.0.1:8080/Service/?CMD=0004|2000001|4
                //if (cmds.Length != 3) break;
                //int _userId005 = 0;
                //int _gamedi5 = 0;
                //if (int.TryParse(cmds[1], out _userId005) && int.TryParse(cmds[2], out _gamedi5))
                //{
                //    if (_gamedi5 == BullFightLobby.instance.Gameid)
                //    {
                //        //只修改内存数据,不做持久化
                //        UserStatus _us = BullFightLobby.instance.GetUserStatusbyUserID(_userId005);
                //        if (_us == null) break;
                //        BullFightTable _bftable = BullFightLobby.instance.GetTableByRoomIDandTableID(_us.RoomID, _us.TableID);
                //        if (_bftable == null) break;
                //        _bftable.ApplyExitTable(_userId005);

                //        //_bfuser.UpdateMoney(99);            被覆盖了,无效
                //        errorCode = "1";
                //    }
                //    else if (_gamedi5 == LandLordLobby.instance.Gameid)
                //    {
                //        //只修改内存数据,不做持久化
                //        UserStatus _us = LandLordLobby.instance.GetUserStatusbyUserID(_userId005);
                //        if (_us == null) break;
                //        LandLordTable _bftable = LandLordLobby.instance.GetTableByRoomIDandTableID(_us.RoomID, _us.TableID);
                //        if (_bftable == null) break;
                //        _bftable.ApplyExitTable(_userId005);

                //        //_bfuser.UpdateMoney(99);            被覆盖了,无效
                //        errorCode = "1";
                //    }
                //    }
                break;

            case "cs_setcard_ll_gm":    //设置指定玩家牌型最小    ?CMD=1001|1380162     http://127.0.0.1:8080/Service/?CMD=cs_setcard_ll_gm|1380162|4
                cs_setcard_ll_gm _setcard = JsonUtils.Deserialize <cs_setcard_ll_gm>(json);
                if (_setcard != null)
                {
                    int _userId1001             = _setcard.userid;
                    int _gameid1001             = _setcard.gameid;
                    sc_setcard_ll_gm _scSetcard = new sc_setcard_ll_gm()
                    {
                        fn = "sc_setcard_ll_gm", _good = true, _info = "", _ret = 1
                    };
                    if (_gameid1001 == BullFight100Lobby.instance.Gameid)
                    {
                        //只修改内存数据,不做持久化
                        UserStatus _us = BaseLobby.instanceBase.GetUserStatusbyUserID(_userId1001);
                        if (_us != null)
                        {
                            BullFight100Table _bftable = BullFight100Lobby.instance.GetTableByRoomIDandTableID(_us.RoomID, _us.TableID);
                            if (_bftable != null)
                            {
                                ////_bftable.ForeashAllDo((i) =>
                                ////{
                                ////    if (_bftable._DicPos2User[i]._userid == _userId1001)
                                ////    {
                                ////        _bftable._DicPos2User[i]._shouPaiArr = new List<int>() { 103, 103, 202, 203, 201 };
                                ////    }
                                ////});
                                _scSetcard._ret = 0;
                            }
                        }
                    }
                    errorCode = JsonUtils.Serialize(_scSetcard);
                }
                break;

            case "cs_settb_user_gm":
                cs_settb_user_gm _settb_user = JsonUtils.Deserialize <cs_settb_user_gm>(json);
                if (_settb_user != null)
                {
                    tb_User _user = JsonUtils.Deserialize <tb_User>(_settb_user._userjson);
                    tb_UserEx.UpdateData(_user);
                    sc_base_gm _scSetcard = new sc_base_gm()
                    {
                        fn = "cs_settb_user_gm", _info = "", _ret = 0
                    };
                    errorCode = JsonUtils.Serialize(_scSetcard);
                }
                else
                {
                    sc_base_gm _scSetcard = new sc_base_gm()
                    {
                        fn = "cs_settb_user_gm", _info = "参数错误", _ret = 1
                    };
                    errorCode = JsonUtils.Serialize(_scSetcard);
                }
                break;

            case "cs_setuserdes_gm":
                cs_setuserdes_gm _setuserinfo = JsonUtils.Deserialize <cs_setuserdes_gm>(json);
                if (_setuserinfo != null)
                {
                    int        _userId1001 = _setuserinfo.userid;
                    sc_base_gm _scResult   = new sc_base_gm()
                    {
                        fn = "cs_setuserdes_gm", _info = "", _ret = 0
                    };
                    tb_User _user = tb_UserEx.GetFromCachebyUserID(_userId1001);
                    if (_user != null)
                    {
                        if (_user.wechatName != _setuserinfo.webname ||
                            _user.wechatHeadIcon != _setuserinfo.headinfo || _user.AgentId != Convert.ToInt32(_setuserinfo.AgentId))
                        {
                            _user.wechatName     = _setuserinfo.webname;
                            _user.wechatHeadIcon = _setuserinfo.headinfo;
                            _user.AgentId        = Convert.ToInt32(_setuserinfo.AgentId);
                            tb_UserEx.UpdateData(_user);
                        }
                        else
                        {
                            _scResult._ret  = 1;
                            _scResult._info = "无需重新设置";
                        }
                    }
                    else
                    {
                        _scResult._ret  = 1;
                        _scResult._info = "会员不存在";
                    }
                    errorCode = JsonUtils.Serialize(_scResult);
                }
                else
                {
                    sc_base_gm _scSetcard = new sc_base_gm()
                    {
                        fn = "cs_setuserdes_gm", _info = "参数错误", _ret = 1
                    };
                    errorCode = JsonUtils.Serialize(_scSetcard);
                }
                break;

            case "cs_setagent_ll_gm":    //设置代理
                cs_setagent_ll_gm _setagent = JsonUtils.Deserialize <cs_setagent_ll_gm>(json);
                if (_setagent != null)
                {
                    int        _userId1001 = _setagent.userid;
                    sc_base_gm _scResult   = new sc_base_gm()
                    {
                        fn = "sc_setagent_ll_gm", _info = "", _ret = 0
                    };
                    tb_User _user = tb_UserEx.GetFromCachebyUserID(_userId1001);
                    if (_user != null)
                    {
                        if (_user.isagent != _setagent.agentid)
                        {
                            _user.isagent = _setagent.agentid;
                            tb_UserEx.UpdateData(_user);
                        }
                        else
                        {
                            _scResult._ret  = 1;
                            _scResult._info = "无需重新设置";
                        }
                    }
                    else
                    {
                        _scResult._ret  = 1;
                        _scResult._info = "会员不存在";
                    }
                    errorCode = JsonUtils.Serialize(_scResult);
                }
                else
                {
                    sc_base_gm _scSetcard = new sc_base_gm()
                    {
                        fn = "cs_setagent_ll_gm", _info = "参数错误", _ret = 1
                    };
                    errorCode = JsonUtils.Serialize(_scSetcard);
                }
                break;

            case "cs_setrobot_gm":    //设置机器人
                cs_setrobot_gm _setrobot = JsonUtils.Deserialize <cs_setrobot_gm>(json);
                if (_setrobot != null)
                {
                    int        _userId1001 = _setrobot.userid;
                    sc_base_gm _scResult   = new sc_base_gm()
                    {
                        fn = "sc_setagent_ll_gm", _info = "", _ret = 0
                    };
                    tb_User _user = tb_UserEx.GetFromCachebyUserID(_userId1001);
                    if (_user != null)
                    {
                        if (_user.isRobot != _setrobot.isrobot ||
                            _user.winpercent != _setrobot.winpercent ||
                            _user.RobotLevel != _setrobot.robotlevel)
                        {
                            _user.isRobot    = _setrobot.isrobot;
                            _user.RobotLevel = _setrobot.robotlevel;
                            _user.winpercent = _setrobot.winpercent;
                            tb_UserEx.UpdateData(_user);
                        }
                        else
                        {
                            _scResult._ret  = 1;
                            _scResult._info = "无需重新设置";
                        }
                    }
                    else
                    {
                        _scResult._ret  = 1;
                        _scResult._info = "会员不存在";
                    }
                    errorCode = JsonUtils.Serialize(_scResult);
                }
                else
                {
                    sc_base_gm _scSetcard = new sc_base_gm()
                    {
                        fn = "cs_setagent_ll_gm", _info = "参数错误", _ret = 1
                    };
                    errorCode = JsonUtils.Serialize(_scSetcard);
                }
                break;

            case "cs_setlocktime_gm":    //锁定账号
                cs_setlocktime_gm _setlocktime = JsonUtils.Deserialize <cs_setlocktime_gm>(json);
                if (_setlocktime != null)
                {
                    int        _userId1001 = _setlocktime.userid;
                    sc_base_gm _scResult   = new sc_base_gm()
                    {
                        fn = "sc_setagent_ll_gm", _info = "", _ret = 0
                    };
                    tb_User _user = tb_UserEx.GetFromCachebyUserID(_userId1001);
                    if (_user != null)
                    {
                        _user.lockTime = _setlocktime.locktime;
                        tb_UserEx.UpdateData(_user);
                    }
                    else
                    {
                        _scResult._ret  = 1;
                        _scResult._info = "会员不存在";
                    }
                    errorCode = JsonUtils.Serialize(_scResult);
                }
                else
                {
                    sc_base_gm _scSetcard = new sc_base_gm()
                    {
                        fn = "cs_setlocktime_gm", _info = "参数错误", _ret = 1
                    };
                    errorCode = JsonUtils.Serialize(_scSetcard);
                }
                break;

            case "cs_charge_gm":    //修改充值金额或钻石
                cs_charge_gm _charge = JsonUtils.Deserialize <cs_charge_gm>(json);
                if (_charge != null)
                {
                    sc_charge_gm _scResult = new sc_charge_gm()
                    {
                        fn = "sc_charge_gm", _info = "", _ret = 0, UserMoney = 0
                    };
                    tb_User _user = tb_UserEx.GetFromCachebyUserID(_charge.userid);
                    if (_user != null)
                    {
                        if (_charge.type == 1)
                        {
                            _scResult.UserMoney = _user.UserMoney;
                            _user.UserMoney    += (decimal)_charge.money;
                            _user.TotalMoney   += (decimal)_charge.money;
                        }
                        else
                        {
                            _scResult.UserMoney = (decimal)_user.diamond;
                            _user.diamond      += _charge.money;
                            _user.totaldiamond += (decimal)_charge.money;
                        }
                        tb_UserEx.UpdateData(_user);
                    }
                    else
                    {
                        _scResult._ret  = 1;
                        _scResult._info = "会员不存在";
                    }
                    errorCode = JsonUtils.Serialize(_scResult);
                }
                else
                {
                    sc_base_gm _scSetcard = new sc_base_gm()
                    {
                        fn = "sc_charge_gm", _info = "参数错误", _ret = 1
                    };
                    errorCode = JsonUtils.Serialize(_scSetcard);
                }
                break;

            case "cs_setNotice_gm":
                cs_setnotice_gm _setnotice = JsonUtils.Deserialize <cs_setnotice_gm>(json);
                if (_setnotice != null)
                {
                    //播放消息还没做好  BullFightLobby.SendChat(_user.UserID, gm);
                }
                break;

            case "cs_applyexittable_gm":        //tick somebody
                cs_applyexittable_gm _applyexit = JsonUtils.Deserialize <cs_applyexittable_gm>(json);
                if (_applyexit != null)
                {
                    sc_base_gm _scSetcard = new sc_base_gm()
                    {
                        fn = "sc_base_gm", _info = "", _ret = 0
                    };

                    if (_applyexit.gameid == BullFight100Lobby.instance.Gameid)
                    {
                        //只修改内存数据,不做持久化
                        UserStatus _us = BaseLobby.instanceBase.GetUserStatusbyUserID(_applyexit.userid);
                        if (_us != null)
                        {
                            BullFight100Table _bftable = BullFight100Lobby.instance.GetTableByRoomIDandTableID(_us.RoomID, _us.TableID);
                            if (_bftable != null)
                            {
                                _bftable.ApplyExitTable(_applyexit.userid);
                            }
                            _scSetcard._ret = 1;
                        }
                    }

                    errorCode = JsonUtils.Serialize(_scSetcard);
                }
                else
                {
                    sc_base_gm _scSetcard = new sc_base_gm()
                    {
                        fn = "cs_applyexittable_gm", _info = "参数错误", _ret = 1
                    };
                    errorCode = JsonUtils.Serialize(_scSetcard);
                }
                break;

            case "cs_createtable_gm":
                ////cs_createtable_gm _createtable = JsonUtils.Deserialize<cs_createtable_gm>(json);
                ////if (_createtable != null)
                ////{
                ////    sc_base_gm _scSetcard = new sc_base_gm() { fn = "sc_base_gm", _info = "", _ret = 0 };

                ////    if (_createtable.gameid == BullFightLobby.instance.Gameid)
                ////    {
                ////        cs_enterroom _enterroomdata = new cs_enterroom();
                ////        _enterroomdata.gameid = _createtable.gameid;   //暂时写固定
                ////        _enterroomdata.levelid = 1;   //暂时写固定
                ////        _enterroomdata.gametype = 1;
                ////        _enterroomdata.baseallmoney = 10000;
                ////        _enterroomdata.numpertable = 4;
                ////        _enterroomdata.roomcard = 2;
                ////        _enterroomdata.tableCount = 3;
                ////        _enterroomdata.rankertype = 2;

                ////    }
                ////    errorCode = JsonUtils.Serialize(_scSetcard);
                ////}
                break;
            //case "cs_getonlinecount_gm":
            //    ////cs_getonlinecount_gm _getonline = JsonUtils.Deserialize<cs_getonlinecount_gm>(json);
            //    ////if (_getonline != null)
            //    ////{
            //    ////    sc_getonlinecount_gm _scSetcard = new sc_getonlinecount_gm() { fn = "sc_getonlinecount_gm", _info = "", _ret = 0 };

            //    ////    if (_getonline.gameid == BullFightLobby.instance.Gameid)
            //    ////    {
            //    ////        //只修改内存数据,不做持久化
            //    ////        UserStatus _us = BaseLobby.instanceBase.GetUserStatusbyUserID(_applyexit.userid);
            //    ////        if (_us != null)
            //    ////        {
            //    ////            BullFightTable _bftable = BullFightLobby.instance.GetTableByRoomIDandTableID(_us.RoomID, _us.TableID);
            //    ////            if (_bftable != null) _bftable.ApplyExitTable(_applyexit.userid);
            //    ////            _scSetcard._ret = 1;
            //    ////        }
            //    ////    }
            //    ////    else if (_applyexit.gameid == LandLordLobby.instance.Gameid)
            //    ////    {

            //    ////    }
            //    ////    errorCode = JsonUtils.Serialize(_scSetcard);
            //    ////}
            //    break;
            case "cs_enterroom_gm":
                cs_enterroom_gm _createroomtable = JsonUtils.Deserialize <cs_enterroom_gm>(json);
                if (_createroomtable != null)
                {
                    sc_enterroom_gm _scSetcard = new sc_enterroom_gm()
                    {
                        fn = "sc_enterroom_gm", _info = "", _ret = 0
                    };
                    //只修改内存数据,不做持久化
                    UserStatus _us = BaseLobby.instanceBase.GetUserStatusbyUserID(_createroomtable.userid);
                    if (_us == null)
                    {
                        var     cacheSet  = new PersonalCacheStruct <tb_User>();
                        tb_User _tempuser = cacheSet.FindKey(_createroomtable.userid.ToString());
                        if (cacheSet.Count == 0 || _tempuser == null)
                        {
                            SchemaTable    schema   = EntitySchemaSet.Get <tb_User>();
                            DbBaseProvider provider = DbConnectionProvider.CreateDbProvider(schema);
                            DbDataFilter   filter   = new DbDataFilter(0);
                            filter.Condition = provider.FormatFilterParam("UserId");
                            filter.Parameters.Add("UserId", _createroomtable.userid);
                            cacheSet.TryRecoverFromDb(filter);                                //从数据库中恢复数据
                            ////cacheSet.TryRecoverFromDb(new DbDataFilter(0));//all
                            _tempuser = cacheSet.FindKey(_createroomtable.userid.ToString()); //
                        }
                        if (_tempuser == null)
                        {
                            ErrorRecord.Record("CommonLogic 201611051736 User数据找不到SessionUserID:" + _createroomtable.userid);
                            return("");
                        }
                        cs_enterroom _enterData = new cs_enterroom()
                        {
                            cc          = 0,
                            fn          = "cs_enterroom",
                            gameid      = _createroomtable.gameid,
                            levelid     = _createroomtable.levelid,
                            gametype    = _createroomtable.gametype,
                            numpertable = _createroomtable.numpertable,
                            rankertype  = _createroomtable.rankertype,
                            roomcard    = _createroomtable.roomcard,
                            tableCount  = _createroomtable.tableCount,
                            _userid     = _createroomtable.userid
                        };
                        CommonLogic _commonLogic = new CommonLogic();
                        _scSetcard.tablenum = _commonLogic.EnterRoom(_tempuser, _enterData);
                    }
                    errorCode = JsonUtils.Serialize(_scSetcard);
                }
                break;

            case "cs_maintain_operation":
                cs_maintain_operation data = JsonUtils.Deserialize <cs_maintain_operation>(json);
                _syncTimer.Start();
                sc_maintain_operation sedata = new sc_maintain_operation {
                    fn = "sc_maintain_operation", _ret = 1, _info = "操作成功"
                };
                int tableCount = 0;
                var brlist     = BullFight100Room.roomCache.FindAll();
                foreach (var bullfightroom in brlist)
                {
                    tableCount += bullfightroom.DicTable.Count;
                }
                sedata.tableCount = tableCount;
                errorCode         = JsonUtils.Serialize(sedata);
                break;

            case "cs_getonlinecount_gm":
                sc_getonlinecount senddata = new sc_getonlinecount {
                    fn = "sc_getonlinecount", _ret = 1, _info = "获取成功"
                };
                senddata.userCount = GameSession.Count;
                errorCode          = JsonUtils.Serialize(senddata);
                break;

            case "cs_closetable":
                cs_closetable receiveData = JsonUtils.Deserialize <cs_closetable>(json);
                // receiveData.
                sc_closetable sendData = new sc_closetable {
                    fn = "sc_closetable", _ret = 1, _info = "操作成功"
                };
                if (receiveData.userNo <= 0)
                {
                    sendData._ret  = -1;
                    sendData._info = "用户名错误";
                    errorCode      = JsonUtils.Serialize(sendData);
                    break;
                }
                var userStatus = BullFight100Lobby.instanceBase.GetUserStatusbyUserID(receiveData.userNo);
                if (userStatus == null)
                {
                    sendData._ret  = -1;
                    sendData._info = "用户不存在";
                    errorCode      = JsonUtils.Serialize(sendData);
                    break;
                }
                lock (tablelock)
                {
                    var table = BullFight100Lobby.instance.GetTableByRoomIDandTableID(userStatus.RoomID, userStatus.TableID);
                    table._gameover = true;
                }
                errorCode = JsonUtils.Serialize(sendData);
                break;

            case "cs_updatePro":    //更新机器人获胜几率
                cs_updatePro data1         = JsonUtils.Deserialize <cs_updatePro>(json);
                sc_updatePro sendUpdatePro = new sc_updatePro {
                    fn = "", _ret = 1, _info = "成功"
                };
                var cacheUser = new GameDataCacheSet <tb_User>();
                cacheUser.ReLoad();
                if (cacheUser.Count == 0)
                {
                    DbDataFilter filter = new DbDataFilter();
                    filter.Condition = "isRobot=@isRobot";
                    filter.Parameters.Add("@isRobot", 1);
                    cacheUser.TryRecoverFromDb(filter);
                }
                List <tb_User> userList = new List <tb_User>();
                var            robotId  = tb_UserEx.GetUserIdListByRobot(1);
                robotId.ForEach(d =>
                {
                    tb_User user;
                    cacheUser.TryFindKey(d.ToString(), out user);
                    if (user != null)
                    {
                        user.winpercent = data1.probability;
                        userList.Add(user);
                    }
                });
                cacheUser.AddOrUpdate(userList);
                errorCode = JsonUtils.Serialize(sendUpdatePro);
                break;

            case "cs_updateRobot":    //更新机器人头像名称信息
                cs_updateRobot robotData  = JsonUtils.Deserialize <cs_updateRobot>(json);
                var            result     = UpdateRobotImgAndName(robotData);
                sc_updateRobot sendUpdate = new sc_updateRobot {
                    fn = "", _ret = 1
                };
                sendUpdate._ret = result ? 1 : -1;
                errorCode       = JsonUtils.Serialize(sendUpdate);
                break;

            case "cs_gameinfo":

                sc_gameInfo sendgameinfo = new sc_gameInfo {
                    _ret = 1
                };
                try
                {
                    tb_gamelevelinfo gameinfo = JsonUtils.Deserialize <tb_gamelevelinfo>(json);
                    var gameCache             = new ShareCacheStruct <tb_gamelevelinfo>();
                    gameCache.AddOrUpdate(gameinfo);
                }
                catch (Exception)
                {
                    sendgameinfo._ret = -1;
                }
                errorCode = JsonUtils.Serialize(sendgameinfo);
                break;
            }
            return(errorCode);
        }