Beispiel #1
0
        /// <summary>
        /// 注销
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public async Task <bool> LogoutAsync(LogoutReq req)
        {
            using (var httpClient = new HttpClient())
            {
                Console.WriteLine(req.GetJson());

                var data = new StringContent(req.GetJson());

                var response = await httpClient.PostAsync(req.GetRequestUrl(), data);

                if (response.IsSuccessStatusCode)
                {
                    //{"rescode":"-1","resinfo":"authenticator fail"}
                    //{"rescode":"0","resinfo":"logout success"}
                    var result = response.Content.ReadAsStringAsync().Result;
                    Console.WriteLine(result);
                    JObject o = JObject.Parse(result);
                    if (o.SelectToken("rescode").ToString() == "0")
                    {
                        return(true);
                    }
                    return(false);
                }
            }
            return(false);
        }
Beispiel #2
0
        public async Task <LogoutRes> LogoutRequest(LogoutReq logoutPacket)
        {
            var resPacket = new LogoutRes();

            Console.WriteLine($"Id({logoutPacket.UserId}), Send Logout Packet");

            // DB서버에 유저의 토큰 값을 내려달라고 요청.
            var tokenDeleteReq = new DBServer.TokenDeleteReq()
            {
                UserId = logoutPacket.UserId,
                Token  = logoutPacket.Token
            };

            var tokenDeleteRes = await Util.HttpMessenger.RequestHttp <DBServer.TokenDeleteReq, DBServer.TokenDeleteRes>(
                LoginServerMain.config.DBServerAddress, "DB/DeleteToken", tokenDeleteReq);

            if (tokenDeleteRes.Result != (short)ErrorCode.None)
            {
                Console.WriteLine($"Id({logoutPacket.UserId}), Error : {tokenDeleteRes.Result}");
                resPacket.Result = tokenDeleteRes.Result;
                return(resPacket);
            }

            Console.WriteLine($"Id({logoutPacket.UserId}), Logout Success");
            resPacket.Result = (short)ErrorCode.None;
            return(resPacket);
        }
        public static LogoutResp Logout(LogoutReq req)
        {
            var ret = Class1.DoHttpRequest("/logout", "POST", new Dictionary <string, string> {
                { "access_token", Class1.AccessToken }
            }, JsonConvert.SerializeObject(req));
            var resp = JsonConvert.DeserializeObject <LogoutResp>(ret);

            return(resp);
        }
Beispiel #4
0
        public string Logout(LogoutReq para, Action <ResponseEvent> callback)
        {
            const int subcmd  = (int)ProtoCmd.ECmdLogoutReq;
            var       reponse = new NetResponseCallback(LogoutResponse);
            var       seq     = this.Send(para, subcmd, reponse, callback);

            Debugger.Log("Logout_Para {0} {1}", para, seq);

            return(seq);
        }
Beispiel #5
0
 /// <summary>
 /// The API Login service enables customers to log in to the API
 /// service and initiates a secure session for the user.
 /// Users can have multiple sessions 'alive' at any point in time.
 /// </summary>
 public void Logout()
 {
     try
     {
         const string serviceName = "Logout";
         Console.WriteLine("{0}$ API_SERVICE {1}", DateTime.Now, serviceName);
         var request = new LogoutReq();
         if (_bfGlobalService != null)
         {
             _bfGlobalService.logout(request);
         }
     }
     finally
     {
         if (_autoKeepAliveThread != null)
         {
             _autoKeepAliveThread.Abort();
         }
     }
 }
Beispiel #6
0
 /// <summary>
 /// The API Login service enables customers to log in to the API 
 /// service and initiates a secure session for the user. 
 /// Users can have multiple sessions 'alive' at any point in time.
 /// </summary>
 public void Logout()
 {
     try
     {
         const string serviceName = "Logout";
         Console.WriteLine("{0}$ API_SERVICE {1}", DateTime.Now, serviceName);
         var request = new LogoutReq();
         if (_bfGlobalService != null) _bfGlobalService.logout(request);
     }
     finally
     {
         if (_autoKeepAliveThread != null)
         {
             _autoKeepAliveThread.Abort();
         }
     }
 }
 /// <remarks/>
 public void logoutAsync(LogoutReq request, object userState) {
     if ((this.logoutOperationCompleted == null)) {
         this.logoutOperationCompleted = new System.Threading.SendOrPostCallback(this.OnlogoutOperationCompleted);
     }
     this.InvokeAsync("logout", new object[] {
                 request}, this.logoutOperationCompleted, userState);
 }
 /// <remarks/>
 public void logoutAsync(LogoutReq request) {
     this.logoutAsync(request, null);
 }
 public LogoutResp logout(LogoutReq request) {
     object[] results = this.Invoke("logout", new object[] {
                 request});
     return ((LogoutResp)(results[0]));
 }