public async Task <RpcResult <GetUserRsp> > CheckLoginAsync(CheckLoginReq req, int timeOut = 3000)
        {
            AmpMessage message = AmpMessage.CreateRequestMessage(10001, 34);

            message.FriendlyServiceName = "UserGateService.CheckLogin";
            message.Data = req.ToByteArray();
            var response = await base.CallInvoker.AsyncCall(message, timeOut);

            if (response == null)
            {
                throw new RpcException("error,response is null !");
            }
            var result = new RpcResult <GetUserRsp>();

            if (response.Code != 0)
            {
                result.Code = response.Code;
            }
            else if (response.Data == null)
            {
                result.Code = ErrorCodes.CODE_INTERNAL_ERROR;
            }
            else
            {
                result.Data = GetUserRsp.Parser.ParseFrom(response.Data);
            }

            return(result);
        }
예제 #2
0
        //调用委托
        private async Task <AmpMessage> ProcessCheckLoginAsync(AmpMessage req)
        {
            CheckLoginReq request = null;

            if (req.Data == null)
            {
                request = new CheckLoginReq();
            }
            else
            {
                request = CheckLoginReq.Parser.ParseFrom(req.Data);
            }

            req.FriendlyServiceName = "UserGateService.CheckLogin";

            var result = await CheckLoginAsync(request);

            var response = AmpMessage.CreateResponseMessage(req.ServiceId, req.MessageId);

            response.FriendlyServiceName = "UserGateService.CheckLogin";
            response.Code = result.Code;
            if (result.Data != null)
            {
                response.Data = result.Data.ToByteArray();
            }
            return(response);
        }
예제 #3
0
 //抽象方法
 public abstract Task <RpcResult <GetUserRsp> > CheckLoginAsync(CheckLoginReq req);