Esempio n. 1
0
 public IActionResult GetWeixinMessage()
 {
     if (httpContextAccessor.HttpContext.Request.Method.ToUpper() == "POST")
     {
     }
     else if (httpContextAccessor.HttpContext.Request.Method.ToUpper() == "GET")
     {
         string signature = httpContextAccessor.HttpContext.Request.Query["signature"];
         string timestamp = httpContextAccessor.HttpContext.Request.Query["timestamp"];
         string nonce     = httpContextAccessor.HttpContext.Request.Query["nonce"];
         string echostr   = httpContextAccessor.HttpContext.Request.Query["echostr"];
         if (LoginByWeixin.CheckedSignature(timestamp, nonce, signature))
         {
             return(Content(echostr));
         }
     }
     return(Content(""));
 }
Esempio n. 2
0
 public IActionResult GetWeixinMessage([FromServices] ILogger <GameController> logger)
 {
     if (httpContextAccessor.HttpContext.Request.Method.ToUpper() == "POST")
     {
     }
     else if (httpContextAccessor.HttpContext.Request.Method.ToUpper() == "GET")
     {
         bool IsWeiXinServerRequest = IsWeixinSeverIp(logger);
         if (!IsWeiXinServerRequest)
         {
             return(Content(""));
         }
         string signature = httpContextAccessor.HttpContext.Request.Query["signature"];
         string timestamp = httpContextAccessor.HttpContext.Request.Query["timestamp"];
         string nonce     = httpContextAccessor.HttpContext.Request.Query["nonce"];
         string echostr   = httpContextAccessor.HttpContext.Request.Query["echostr"];
         if (LoginByWeixin.CheckedSignature(timestamp, nonce, signature))
         {
             return(Content(echostr));
         }
     }
     return(Content(""));
 }