Exemplo n.º 1
0
        public HttpResponseMessage getIdleAgent([FromBody] AgentRequest nAgentRequest)
        {
            AgentResult agentResult_ = new AgentResult();

            agentResult_.mErrorCode  = ConstAspect.mFail;
            agentResult_.mServerInfo = ServerAspect.getServerInfo(nAgentRequest.mOperatorName, nAgentRequest.mVersionNo, nAgentRequest.mServerId);
            agentResult_.mAgentIp    = "";
            agentResult_.mAgentPort  = "";

            int classify_ = 0;

            if (null != agentResult_.mServerInfo)
            {
                classify_ = agentResult_.mServerInfo.mClassify;
            }
            if (0 == classify_)
            {
                agentResult_.mErrorCode = ConstAspect.mServerId;
                return(toJson(agentResult_));
            }

            AgentInfo agentInfo_ = AgentAspect.getIdleAgent(nAgentRequest.mOperatorName, nAgentRequest.mVersionNo, classify_);

            if (null == agentInfo_)
            {
                agentResult_.mErrorCode = ConstAspect.mAgent;
                return(toJson(agentResult_));
            }
            agentResult_.mErrorCode = ConstAspect.mSucess;
            agentResult_.mAgentIp   = agentInfo_.mAgentIp;
            agentResult_.mAgentPort = agentInfo_.mAgentPort;
            return(toJson(agentResult_));
        }
Exemplo n.º 2
0
        public HttpResponseMessage getServerList([FromBody] ServerRequest nServerRequest)
        {
            ServerResult serverResult_ = new ServerResult();

            serverResult_.mServerItems = ServerAspect.getServerItems(nServerRequest.mOperatorName, nServerRequest.mVersionNo);
            serverResult_.mServerInfos = ServerAspect.getServerInfos(nServerRequest.mOperatorName, nServerRequest.mVersionNo);
            serverResult_.mNetIps      = new List <NetIp>();
            AgentAspect.pushNetIp(serverResult_.mNetIps, nServerRequest.mOperatorName, nServerRequest.mVersionNo, nServerRequest.mClassify);
            SocialAspect.pushNetIp(serverResult_.mNetIps, nServerRequest.mOperatorName, nServerRequest.mVersionNo, nServerRequest.mClassify);
            GameAspect.pushNetIp(serverResult_.mNetIps, nServerRequest.mOperatorName, nServerRequest.mVersionNo, nServerRequest.mClassify);
            return(ConstAspect.toJson(serverResult_));
        }