Esempio n. 1
0
        // GET: WeiXinReplay
        public ActionResult Index(string signature, string timestamp, string nonce, string echostr)
        {
            Logger.Info($"signature:{signature}   / timestamp:{timestamp}   /  nonce:{nonce} / echostr :{echostr}");

            if (string.IsNullOrEmpty(echostr))
            {
                //自动回复
            }


            Logger.Info($"AppToken:{AppToken}  ");

            //验证
            if (string.IsNullOrEmpty(AppToken))
            {
                return(Content("请先设置Token!"));
            }

            var ent = "";

            if (!WeiXinCheck.CheckSignature(signature, timestamp, nonce, AppToken, out ent))
            {
                return(Content("参数错误!"));
            }
            Logger.Info($"echostr:{echostr}  ***************************************************************8888888888");
            return(Content(echostr)); //返回随机字符串则表示验证通过

            //var tonken = _weiXinService.GetAccess_token();
        }
        // GET: WeiXinReplay
        public ActionResult Index(string signature, string timestamp, string nonce, string echostr)
        {
            if (string.IsNullOrEmpty(AppToken))
            {
                return(Content("请先设置Token!"));
            }

            var ent = "";

            if (!WeiXinCheck.CheckSignature(signature, timestamp, nonce, AppToken, out ent))
            {
                return(Content("参数错误!"));
            }
            return(Content(echostr)); //返回随机字符串则表示验证通过

            //var tonken = _weiXinService.GetAccess_token();

            return(Content(echostr));
        }