예제 #1
0
        /// <summary>
        /// 扫一扫
        /// </summary>
        public static void ResponseAdvClickEvent(HttpResponseBase Response, MsgModel msg, ResultCryptography ccg)
        {
            string remsg  = string.Empty;
            string openid = msg.FromUserName;
            //LogHelper.WriteLog("lalal" + ConfigurationManager.AppSettings["ScanCodeInfoUrl"] + "?url=" + System.Web.HttpUtility.UrlEncode(msg.EventModel.ClickEventModel.ScanResult) + "&openid=" + openid);
            //调用积分url
            string ret = BasicApi.RequestCreate(ConfigurationManager.AppSettings["ScanCodeInfoUrl"] + "?url=" + System.Web.HttpUtility.UrlEncode(msg.EventModel.ClickEventModel.ScanResult) + "&openid=" + openid);

            //LogHelper.WriteLog(ConfigurationManager.AppSettings["ScanCodeInfoUrl"]);

            msg.TextModel = new TextModel()
            {
                Content = ret
            };
            remsg = XmlHelpler.GetTextXml(msg);
            Response.Write(GetMsg(remsg, ccg));
        }
예제 #2
0
        /// <summary>
        /// 关注事件
        /// </summary>
        /// <param name="httpRequest"></param>
        /// <param name="msg"></param>
        public static void ResponseSubscribeEvent(HttpResponseBase Response, MsgModel msg, ResultCryptography ccg)
        {
            string openid = msg.FromUserName;
            string ret    = BasicApi.RequestCreate(ConfigurationManager.AppSettings["AddFollowerOpenId"] + "?id=" + msg.EventModel.EventKeyModel.EventKey + "&openid=" + openid);
            var    remsg  = "";

            try
            {
                string str = msg.EventModel.EventKeyModel.EventKey;
                if (!string.IsNullOrEmpty(str))
                {
                    int Id = Convert.ToInt32(System.Text.RegularExpressions.Regex.Replace(str, @"[^0-9]+", ""));
                    if (Id < 10000 && Id > 0)
                    {
                        msg.MsgType = "news";
                        ArticelModel articel = new ArticelModel()
                        {
                            Title       = "味达美厨师会员招募啦!点击图片即可注册!",
                            Description = "积分好礼、国内外学习考察、新品试用等你来!",
                            PicUrl      = "https://mmbiz.qpic.cn/mmbiz_jpg/uuwJXDpEBqsSZZuaafJUZfNibZ109B0CXbWpLSaKEdQdibozC0LOibu9Eshs0R1yfgFNOYvI0icb7ntDKXC2k06tVw/0?wx_fmt=jpeg",
                            Url         = ConfigurationManager.AppSettings["WeiXinDomain"] + "component/register"
                        };
                        ArticelModel articel2 = new ArticelModel()
                        {
                            Title       = "会员扫码须知",
                            Description = "会员扫码须知",
                            PicUrl      = "https://mmbiz.qpic.cn/mmbiz_jpg/uuwJXDpEBqtaGUZZoklAKp1sE9eqTK2Mia7RSpH0AyT3lP5BaxNJkiagobOIz3Gpe2ZQs3HYz8icFKw3wxic35KApQ/0?wx_fmt=jpeg",
                            Url         = "http://jifenweixin.shinho.net.cn/#/component/activityrule"
                        };
                        ArticelModel articel3 = new ArticelModel()
                        {
                            Title       = "即日起至2月10日,凡任务达标者即可瓜分20万积分红包!",
                            Description = "即日起至2月10日,凡任务达标者即可瓜分20万积分红包!",
                            PicUrl      = "https://mmbiz.qpic.cn/mmbiz_jpg/uuwJXDpEBqtIndjMF7wbHqDy3CVVvrmTHXAdA9QtewoUvqgazfLlCmfhjExN3HuHk7sbtgp6trxNqt64Z01uqA/0?wx_fmt=jpeg",
                            Url         = "http://mp.weixin.qq.com/s/5H6_rnk86ai2fOs-ChI2Gg"
                        };

                        msg.Articles = new List <ArticelModel>();
                        msg.Articles.Add(articel);
                        msg.Articles.Add(articel2);
                        msg.Articles.Add(articel3);
                        remsg = XmlHelpler.GetArticlesXml(msg);
                    }
                    else
                    {
                        msg.MsgType = "news";
                        ArticelModel articel = new ArticelModel()
                        {
                            Title       = "味达美厨师会员招募啦!点击图片即可注册!",
                            Description = "积分好礼、国内外学习考察、新品试用等你来!",
                            PicUrl      = "https://mmbiz.qpic.cn/mmbiz_jpg/uuwJXDpEBqsSZZuaafJUZfNibZ109B0CXbWpLSaKEdQdibozC0LOibu9Eshs0R1yfgFNOYvI0icb7ntDKXC2k06tVw/0?wx_fmt=jpeg",
                            Url         = ConfigurationManager.AppSettings["WeiXinDomain"] + "component/register"
                        };

                        msg.Articles = new List <ArticelModel>();
                        msg.Articles.Add(articel);
                        remsg = XmlHelpler.GetArticlesXml(msg);
                    }
                }
                else
                {
                    msg.MsgType = "news";
                    ArticelModel articel = new ArticelModel()
                    {
                        Title       = "味达美厨师会员招募啦!点击图片即可注册!",
                        Description = "积分好礼、国内外学习考察、新品试用等你来!",
                        PicUrl      = "https://mmbiz.qpic.cn/mmbiz_jpg/uuwJXDpEBqsSZZuaafJUZfNibZ109B0CXbWpLSaKEdQdibozC0LOibu9Eshs0R1yfgFNOYvI0icb7ntDKXC2k06tVw/0?wx_fmt=jpeg",
                        Url         = ConfigurationManager.AppSettings["WeiXinDomain"] + "component/register"
                    };
                    ArticelModel articel2 = new ArticelModel()
                    {
                        Title       = "会员扫码须知",
                        Description = "会员扫码须知",
                        PicUrl      = "https://mmbiz.qpic.cn/mmbiz_jpg/uuwJXDpEBqtaGUZZoklAKp1sE9eqTK2Mia7RSpH0AyT3lP5BaxNJkiagobOIz3Gpe2ZQs3HYz8icFKw3wxic35KApQ/0?wx_fmt=jpeg",
                        Url         = "http://jifenweixin.shinho.net.cn/#/component/activityrule"
                    };
                    ArticelModel articel3 = new ArticelModel()
                    {
                        Title       = "即日起至2月10日,凡任务达标者即可瓜分20万积分红包!",
                        Description = "即日起至2月10日,凡任务达标者即可瓜分20万积分红包!",
                        PicUrl      = "https://mmbiz.qpic.cn/mmbiz_jpg/uuwJXDpEBqtIndjMF7wbHqDy3CVVvrmTHXAdA9QtewoUvqgazfLlCmfhjExN3HuHk7sbtgp6trxNqt64Z01uqA/0?wx_fmt=jpeg",
                        Url         = "http://mp.weixin.qq.com/s/5H6_rnk86ai2fOs-ChI2Gg"
                    };
                    msg.Articles = new List <ArticelModel>();
                    msg.Articles.Add(articel);
                    msg.Articles.Add(articel2);
                    msg.Articles.Add(articel3);
                    remsg = XmlHelpler.GetArticlesXml(msg);
                }
            }
            catch
            {
                msg.MsgType = "news";
                ArticelModel articel = new ArticelModel()
                {
                    Title       = "味达美厨师会员招募啦!点击图片即可注册!",
                    Description = "积分好礼、国内外学习考察、新品试用等你来!",
                    PicUrl      = "https://mmbiz.qpic.cn/mmbiz_jpg/uuwJXDpEBqsSZZuaafJUZfNibZ109B0CXbWpLSaKEdQdibozC0LOibu9Eshs0R1yfgFNOYvI0icb7ntDKXC2k06tVw/0?wx_fmt=jpeg",
                    Url         = ConfigurationManager.AppSettings["WeiXinDomain"] + "component/register"
                };
                ArticelModel articel2 = new ArticelModel()
                {
                    Title       = "会员扫码须知",
                    Description = "会员扫码须知",
                    PicUrl      = "https://mmbiz.qpic.cn/mmbiz_jpg/uuwJXDpEBqtaGUZZoklAKp1sE9eqTK2Mia7RSpH0AyT3lP5BaxNJkiagobOIz3Gpe2ZQs3HYz8icFKw3wxic35KApQ/0?wx_fmt=jpeg",
                    Url         = "http://jifenweixin.shinho.net.cn/#/component/activityrule"
                };
                ArticelModel articel3 = new ArticelModel()
                {
                    Title       = "即日起至2月10日,凡任务达标者即可瓜分20万积分红包!",
                    Description = "即日起至2月10日,凡任务达标者即可瓜分20万积分红包!",
                    PicUrl      = "https://mmbiz.qpic.cn/mmbiz_jpg/uuwJXDpEBqtIndjMF7wbHqDy3CVVvrmTHXAdA9QtewoUvqgazfLlCmfhjExN3HuHk7sbtgp6trxNqt64Z01uqA/0?wx_fmt=jpeg",
                    Url         = "http://mp.weixin.qq.com/s/5H6_rnk86ai2fOs-ChI2Gg"
                };
                msg.Articles = new List <ArticelModel>();
                msg.Articles.Add(articel);
                msg.Articles.Add(articel2);
                msg.Articles.Add(articel3);
                remsg = XmlHelpler.GetArticlesXml(msg);
            }

            Response.Write(GetMsg(remsg, ccg));
        }