public override OperationResponse OnHandlerMeesage(OperationRequest request, ClientPeer peer)
        {
            object json;
            request.Parameters.TryGetValue((byte) ParameterCode.UserCheckInfo, out json);
            var user = JsonMapper.ToObject<User>(json.ToString());
            var response = new OperationResponse {OperationCode = request.OperationCode};

            //查询数据库
            var userDb = _manager.GetUserByUsername(user.Username);
            if (userDb == null)
            {
                if (_manager.RegisterUser(user))
                {
                    response.ReturnCode = (short) ReturnCode.Success;
                    peer.SetUser(user);
                }
                else
                {
                    response.ReturnCode = (short) ReturnCode.Eception;
                    response.DebugMessage = "异常";
                }
            }
            else
            {
                response.ReturnCode = (short) ReturnCode.Fail;
                response.DebugMessage = "用户名已存在!";
            }
            return response;
        }
        public override OperationResponse OnHandlerMeesage(OperationRequest request, ClientPeer peer)
        {
            //1.获得客户端发送的帐号和明文密码
            object json;
            request.Parameters.TryGetValue((byte) ParameterCode.UserCheckInfo, out json);
            var user = JsonMapper.ToObject<User>(json.ToString());
            var userDb = _manager.GetUserByUsername(user.Username);
            var s = userDb != null
                ? string.Format("user.Username:{0},user.Password:{1} userDb.Username:{2},userDb.Password:{3}",
                    user.Username, user.Password, userDb.Username, userDb.Password)
                : "未找到用户:" + user.Username;
            peer.WriteLog(s);

            //2.比较,然后创建响应
            var response = new OperationResponse {OperationCode = request.OperationCode};
            if (userDb != null && userDb.Password == MD5Tool.GetMD5(user.Password))
            {
                response.ReturnCode = (short) ReturnCode.Success;
                peer.SetUser(userDb);
            }
            else
            {
                response.ReturnCode = (short) ReturnCode.Fail;
                response.DebugMessage = "用户名或密码错误!";
            }

            return response;
        }