Пример #1
0
        public ActionResult notice(PostModel postModel)
        {
            postModel.Token          = WxRequest._component_Token;
            postModel.EncodingAESKey = WxRequest._component_EncodingAESKey;           //根据自己后台的设置保持一致
            postModel.AppId          = WxRequest._component_AppId;                    //根据自己后台的设置保持一致
            XDocument doc = WXRequestCommandBLL.Init(Request.InputStream, postModel); //执行

            WXRequestCommandBLL.CommandWXCallback(doc, postModel);

            return(Content("success"));
        }
Пример #2
0
        public ActionResult Callback2(PostModel postModel)
        {
            if (postModel == null)
            {
                log4net.LogHelper.WriteInfo(this.GetType(), "微信回调信息postModel为null");
                return(Content("success"));
            }

            try
            {
                postModel.Token          = WxRequest._component_Token;
                postModel.EncodingAESKey = WxRequest._component_EncodingAESKey; //根据自己后台的设置保持一致
                postModel.AppId          = WxRequest._component_AppId;          //根据自己后台的设置保持一致
                var stream = Request.InputStream;

                var tempdoc = XmlUtility.Convert(stream);
                if (tempdoc == null)
                {
                    return(Content("success"));
                }
                var postDataDocument = XDocument.Parse(tempdoc.ToString());
                postDataDocument = WXRequestCommandBLL.Init(postModel, postDataDocument);

                if (postDataDocument != null)
                {
                    string returntype = postDataDocument?.Root?.Element("Event")?.Value;
                    switch (returntype)
                    {
                    case "weapp_audit_success":
                    case "weapp_audit_fail":
                        //小程序代码审核成功回调
                        WXRequestCommandBLL.CommandXCXPublish(returntype, postDataDocument);
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    log4net.LogHelper.WriteInfo(this.GetType(), "微信回调信息错误");
                }
            }
            catch (Exception ex)
            {
                log4net.LogHelper.WriteError(this.GetType(), ex);
            }

            return(Content("success"));
        }
Пример #3
0
        public ActionResult Callback(PostModel postModel)
        {
            //此处的URL格式类型为:http://weixin.senparc.com/Open/Callback/$APPID$, 在RouteConfig中进行了配置,你也可以用自己的格式,只要和开放平台设置的一致。
            if (postModel == null)
            {
                log4net.LogHelper.WriteInfo(this.GetType(), "微信回调信息postModel为null");
                return(Content("success"));
            }

            postModel.Token          = WxRequest._component_Token;
            postModel.EncodingAESKey = WxRequest._component_EncodingAESKey;              //根据自己后台的设置保持一致
            postModel.AppId          = WxRequest._component_AppId;                       //根据自己后台的设置保持一致
            XDocument doc    = WXRequestCommandBLL.Init(Request.InputStream, postModel); //执行
            string    result = WXRequestCommandBLL.CommandWXCallback(doc, postModel);

            return(Content(result));
        }