예제 #1
0
        public ActionResult <string> Post([FromQuery] SignModel signModel)
        {
            var    res                    = string.Empty;
            string requestXml             = Common.ReadRequest(this.Request);
            DefaultMessageHandler handler = new DefaultMessageHandler();

            if (signModel != null && !string.IsNullOrEmpty(signModel.signature) && !CheckSignature.Check(signModel.signature, signModel.timestamp, signModel.nonce, WeiXinContext.Config.Token))
            {
                res = handler.HandleErrorRequest(signModel, requestXml, "验签失败");
            }
            else
            {
                handler = new DefaultMessageHandler(signModel, requestXml);
                res     = handler.HandleRequest();
            }
            return(Content(res, Request.ContentType, Encoding.UTF8));
        }