Ejemplo n.º 1
0
        /// <summary>
        /// 处理消息
        /// </summary>
        /// <param name="clientcommand"></param>
        /// <returns></returns>
        public string DealDataEx(string _data, string _ipport, tb_User _user)
        {
            string senddata = "";

            try
            {
                _strIPandPort = _ipport;
                cs_base _basedata = JsonUtils.Deserialize <cs_base>(_data);
                switch (_basedata.fn)
                {
                case "cs_entertable_bfc":
                    cs_entertable_bfc _entertable = JsonUtils.Deserialize <cs_entertable_bfc>(_data);
                    senddata = EnterTableAdd(_user, _entertable);
                    break;

                case "cs_gambleone_bfc":    //     cs_gamble_bf
                    cs_gambleone_bfc _gambleone = JsonUtils.Deserialize <cs_gambleone_bfc>(_data);
                    return(GambleOne(_user, _gambleone));

                default:
                    ErrorRecord.Record(_basedata.fn + " undeal  201611062128BF ");
                    break;
                }
                return(senddata);
            }
            catch (Exception ex)
            {
                ErrorRecord.Record(ex, " 201206091508BF ");
                return("");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 处理消息
        /// </summary>
        /// <param name="clientcommand"></param>
        /// <returns></returns>
        public string DealDataEx(string _data, string _ipport, tb_User _user)
        {
            string senddata = "";

            try
            {
                _strIPandPort = _ipport;
                cs_base _basedata = JsonUtils.Deserialize <cs_base>(_data);
                switch (_basedata.fn)
                {
                case "11":    //重新登录===============================
                    ////  ipmsgList = ReLogin(Convert.ToString(arro[1]), Convert.ToString(arro[2]));
                    break;

                case "cs_ready_tc":
                    cs_ready_tc _ready = JsonUtils.Deserialize <cs_ready_tc>(_data);
                    senddata = TableReady(_user, _ready);
                    break;

                case "cs_gamble_tc":
                    cs_gamble_tc _gamble = JsonUtils.Deserialize <cs_gamble_tc>(_data);
                    senddata = Gamble(_user, _gamble);
                    break;

                case "cs_showcard_tc":     //
                    cs_showcard_tc _showcard = JsonUtils.Deserialize <cs_showcard_tc>(_data);
                    senddata = ShowCard(_user, _showcard);
                    break;

                case "cs_giveup_tc":    //
                    cs_giveup_tc _giveupobj = JsonUtils.Deserialize <cs_giveup_tc>(_data);
                    senddata = GiveUp(_user, _giveupobj);
                    break;

                case "cs_compare_tc":    //
                    cs_compare_tc _compare = JsonUtils.Deserialize <cs_compare_tc>(_data);
                    senddata = Compare(_user, _compare);
                    break;

                default:    //默认不处理的  发送一个   d- 表示哈
                    ErrorRecord.Record(_basedata.fn + " undeal  201206091508TC ");
                    break;
                }
                return(senddata);
            }
            catch (Exception ex)
            {
                ErrorRecord.Record(ex, " 201206091508BF ");
                return("");
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 客户端请求的参数较验
 /// </summary>
 /// <returns>false:中断后面的方式执行并返回Error</returns>
 public override bool GetUrlElement()
 {
     _headUserID = actionGetter.GetUserId();
     if (actionGetter.GetString("_dataEx", ref _dataEx))
     {
         _temp = JsonUtils.Deserialize <cs_base>(_dataEx);
         if (_temp.fn == "")
         {
             ErrorRecord.Record(" JSON data error! _dataEx:" + _dataEx);
             return(false);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 处理消息
        /// </summary>
        /// <param name="clientcommand"></param>
        /// <returns></returns>
        public string DealDataEx(string _data, string _ipport, tb_User _user)
        {
            string senddata = "";

            try
            {
                _strIPandPort = _ipport;
                cs_base _basedata = JsonUtils.Deserialize <cs_base>(_data);
                switch (_basedata.fn)
                {
                case "cs_entertable_bf100":
                    cs_entertable_bf100 _entertable = JsonUtils.Deserialize <cs_entertable_bf100>(_data);
                    senddata = EnterTableAdd(_user, _entertable);
                    break;

                case "cs_applybanker_bf100":     //  cs_gamble_bf
                    cs_applybanker_bf100 _enterroom = JsonUtils.Deserialize <cs_applybanker_bf100>(_data);
                    senddata = GetBanker(_user, _enterroom);
                    break;

                case "cs_gambleone_bf100":    //     cs_gamble_bf
                    cs_gambleone_bf100 _gambleone = JsonUtils.Deserialize <cs_gambleone_bf100>(_data);
                    return(GambleOne(_user, _gambleone));


                case "cs_bankergetbonuspot_bf100":
                    cs_bankergetbonuspot_bf100 _getPot = JsonUtils.Deserialize <cs_bankergetbonuspot_bf100>(_data);
                    senddata = BankerGetBonusPot(_user, _getPot);
                    break;

                default:
                    ErrorRecord.Record(_basedata.fn + " undeal  201611062128BF ");
                    break;
                }
                return(senddata);
            }
            catch (Exception ex)
            {
                ErrorRecord.Record(ex, " 201206091508BF ");
                return("");
            }
        }
Ejemplo n.º 5
0
        /// <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);
                }
            }
        }