Exemplo n.º 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"]);
            if (ret.Contains("x"))
            {
                //BasicApi.RequestCreate("http://jifenweixin.shinho.net.cn/#/component/scansuccess?integral=" + ret);
                ret         = ret.Replace("x", "");
                msg.MsgType = "news";
                ArticelModel articel = new ArticelModel()
                {
                    Title       = "好手气,拿大奖",
                    Description = "点击上文查看中奖情况",
                    PicUrl      = "https://mmbiz.qpic.cn/mmbiz_jpg/uuwJXDpEBqudkJX4sk2WDIYvqmibxToUKFtPcmLS2c2tnoXvoWoVgANLiaZPvEEAohSxdnTxPdIRSBDy10SPE1TA/0?wx_fmt=jpeg",
                    Url         = ConfigurationManager.AppSettings["WeiXinDomain"] + "component/scansuccess?integral=" + ret
                };
                msg.Articles = new List <ArticelModel>();
                msg.Articles.Add(articel);
                remsg = XmlHelpler.GetArticlesXml(msg);
                Response.Write(GetMsg(remsg, ccg));
            }
            else
            {
                msg.TextModel = new TextModel()
                {
                    Content = ret
                };
                remsg = XmlHelpler.GetTextXml(msg);
                Response.Write(GetMsg(remsg, ccg));
            }
        }
Exemplo n.º 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) && str.Contains("A"))
                {
                    int Id = Convert.ToInt32(System.Text.RegularExpressions.Regex.Replace(str, @"[^0-9]+", ""));

                    if (Id > 1 && Id < 3000)
                    {
                        remsg = ActivityExc(msg, Id);
                    }

                    if (Id < 50000 && Id > 3000)
                    {
                        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       = "味达美厨师会员招募啦!点击图片即可注册!" + str,
                            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"
                    };

                    msg.Articles = new List <ArticelModel>();
                    msg.Articles.Add(articel);
                    msg.Articles.Add(articel2);
                    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"
                };

                msg.Articles = new List <ArticelModel>();
                msg.Articles.Add(articel);
                msg.Articles.Add(articel2);
                remsg = XmlHelpler.GetArticlesXml(msg);
            }

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