Exemplo n.º 1
0
        /// <summary>
        /// 返回游戏列表,只有当前玩家需要处理
        /// </summary>
        /// <returns></returns>
        public string PostFeedback(tb_User _user, cs_feedback _data)
        {
            sc_feedback _senddata = new sc_feedback()
            {
                result = 1, fn = "sc_feedback"
            };
            tb_FeedBack _fbacktable = new tb_FeedBack();

            _fbacktable.content      = _data._content;
            _fbacktable.tel          = _data._tel;
            _fbacktable.UserID       = _user.UserID;
            _fbacktable.UserName     = _user.wechatName;
            _fbacktable.feedbacktype = _data._type;
            tb_FeedbackEx.SetData(_fbacktable);
            return(JsonUtils.Serialize(_senddata));
        }
Exemplo n.º 2
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);
                }
            }
        }