Exemple #1
0
 public void SendMsg()
 {
     this.xmlDoc.LoadXml(this.postStr);
     this.MsgType      = this.xmlDoc.GetElementsByTagName("MsgType")[0].InnerText;
     this.FromUserName = this.xmlDoc.GetElementsByTagName("FromUserName")[0].InnerText;
     try
     {
         this.weiXinLogModel = this.weiXinLogBLL.GetModel(this.FromUserName);
         if (this.weiXinLogModel == null)
         {
             this.weiXinLogModel = new Chain.Model.WeiXinLog();
             this.NoLastOperating();
         }
         else
         {
             this.YesLastOperating(this.postStr);
         }
         this.sendXML = ((this.sendXML == "") ? ResponseSendStr.Text(this.postStr, this.weiXinRuleBLL.ErrorStr()) : this.sendXML);
     }
     catch (Exception e)
     {
         this.Log(e.ToString());
     }
     finally
     {
         this.Log(this.sendXML);
     }
     this.Response.Write(this.sendXML);
 }
Exemple #2
0
 private void WZZ()
 {
     if (this.memBll.GetMemByWeiXinCard(this.FromUserName) == null)
     {
         this.sendXML = ResponseSendStr.Text(this.postStr, "您目前还不是微会员,只有微会员才可以访问微网站");
     }
     else
     {
         string      xml       = File.ReadAllText(this.Server.MapPath("WWZ.xml"));
         XmlDocument xmlWZZDoc = new XmlDocument();
         xmlWZZDoc.LoadXml(xml);
         string NewsTitle    = xmlWZZDoc.GetElementsByTagName("NewsTitle")[0].InnerText;
         string NewsDesc     = xmlWZZDoc.GetElementsByTagName("NewsDesc")[0].InnerText;
         string NewsUrlFirst = string.Concat(new object[]
         {
             "http://",
             PubFunction.curParameter.strDoMain,
             xmlWZZDoc.GetElementsByTagName("NewsUrlFirst")[0].InnerText,
             "?id=",
             Guid.NewGuid()
         });
         string NewsUrlSecond = string.Concat(new string[]
         {
             "http://",
             PubFunction.curParameter.strDoMain,
             xmlWZZDoc.GetElementsByTagName("NewsUrlSecond")[0].InnerText,
             "?MemWeiXinCard=",
             this.FromUserName
         });
         List <Chain.Model.WeiXinNews> newsList = this.GetModel(NewsTitle, NewsDesc, NewsUrlFirst, NewsUrlSecond);
         this.sendXML = ResponseSendStr.News(this.postStr, newsList);
     }
 }
Exemple #3
0
 private void ErrorNewsHandle(string errorTimesExceed, string errorTimesNoExceed)
 {
     if (this.weiXinLogModel.ErrorTimes >= 3)
     {
         this.sendXML = ResponseSendStr.Text(this.postStr, errorTimesExceed);
         this.weiXinLogBLL.Delete(this.FromUserName);
     }
     else
     {
         this.sendXML = ResponseSendStr.Text(this.postStr, errorTimesNoExceed);
         this.weiXinLogBLL.Update(this.weiXinLogModel);
     }
 }
Exemple #4
0
 private void ConvertWeiXinMember(string postStr)
 {
     Chain.Model.Mem mem = this.memBll.GetMemByWeiXinCard(this.FromUserName);
     if (mem != null)
     {
         this.sendXML = ResponseSendStr.Text(postStr, "您已是微信会员");
     }
     else
     {
         this.sendXML = ResponseSendStr.Text(postStr, "您已进入转微信会员模式," + this.weiXinRuleBLL.Reply2());
         this.GiveWeiXinLodAssignment("", 0, "2", "", 0);
         this.weiXinLogBLL.Add(this.weiXinLogModel);
     }
 }
Exemple #5
0
        private void AttentionNews(string postStr)
        {
            string Event = this.xmlDoc.GetElementsByTagName("Event")[0].InnerText;

            if (Event == "subscribe")
            {
                StringBuilder tempSb = new StringBuilder();
                tempSb.AppendLine(PubFunction.curParameter.strWeiXinSalutatory).AppendLine().AppendLine(this.weiXinRuleBLL.AttentionStr());
                this.sendXML = ResponseSendStr.Text(postStr, tempSb.ToString());
            }
            else if (Event == "CLICK")
            {
                this.MenuClick();
            }
        }
Exemple #6
0
 private void UnknownTextNewsHandle(string postStr, string Content)
 {
     this.ruleModel = this.weiXinRuleBLL.GetModelByNewsRuleID(Content);
     if (this.ruleModel != null)
     {
         if (this.ruleModel.RuleNewsType == "text")
         {
             this.sendXML = ResponseSendStr.Text(postStr, this.ruleModel.RuleContent);
         }
         else if (this.ruleModel.RuleNewsType == "news")
         {
             List <Chain.Model.WeiXinNews> newsList = new Chain.BLL.WeiXinNews().GetModelList("NewsRuleID=" + this.ruleModel.RuleID);
             this.sendXML = ResponseSendStr.News(postStr, newsList);
         }
     }
 }
Exemple #7
0
 private void ApplicationMemberCard()
 {
     Chain.Model.Mem mem = this.memBll.GetMemByWeiXinCard(this.FromUserName);
     if (mem == null)
     {
         this.sendXML = ResponseSendStr.Text(this.postStr, "您已进入会员申请模式," + this.weiXinRuleBLL.Reply1());
         this.GiveWeiXinLodAssignment("", 0, "0", "", 0);
         this.weiXinLogBLL.Add(this.weiXinLogModel);
     }
     else
     {
         string NewsDesc = string.IsNullOrEmpty(PubFunction.curParameter.strWeiXinShopName) ? "" : PubFunction.curParameter.strWeiXinShopName;
         NewsDesc = ((NewsDesc == "") ? "您的微信会员卡" : ("您的" + NewsDesc + "微信会员卡"));
         this.Card(mem, "会员卡查询", NewsDesc);
     }
 }
Exemple #8
0
        private void Card(Chain.Model.Mem mem, string NewsTitle, string NewsDesc)
        {
            this.DrawImage(mem, this.FromUserName);
            string NewsUrlFirst = string.Concat(new object[]
            {
                "http://",
                PubFunction.curParameter.strDoMain,
                "/Upload/WeiXin/Images/",
                this.FromUserName,
                ".jpg?id=",
                Guid.NewGuid()
            });
            string NewsUrlSecond = "http://" + PubFunction.curParameter.strDoMain + "/ReceptionPage/index.aspx?MemWeiXinCard=" + this.FromUserName;
            List <Chain.Model.WeiXinNews> newsList = this.GetModel(NewsTitle, NewsDesc, NewsUrlFirst, NewsUrlSecond);

            this.sendXML = ResponseSendStr.News(this.postStr, newsList);
        }
Exemple #9
0
        private void Do1ForApplicationMemberByReplyTelNumber()
        {
            this.Content = this.xmlDoc.GetElementsByTagName("Content")[0].InnerText.Trim();
            if (!PubFunction.curParameter.bolWeiXinSMSVcode || this.weiXinLogModel.RandomCode == this.Content)
            {
                int isOk = this.MemRegister(true);
                if (isOk > 0)
                {
                    this.DoCard("恭喜您会员卡办理成功");
                }
                else
                {
                    string strErr = "系统错误,会员办卡失败!";
                    int    num    = isOk;
                    if (num != -6)
                    {
                        switch (num)
                        {
                        case -2:
                            strErr = "手机号码重复,会员办卡失败!";
                            break;

                        case -1:
                            strErr = "会员卡号重复,会员办卡失败!";
                            break;
                        }
                    }
                    else
                    {
                        strErr = "卡面号重复,会员办卡失败!";
                    }
                    this.sendXML = ResponseSendStr.Text(this.postStr, strErr);
                }
            }
            else
            {
                this.GiveWeiXinLodAssignment(this.weiXinLogModel.RecordContent, this.weiXinLogModel.RecordContentType, this.weiXinLogModel.StatusCode, this.weiXinLogModel.RandomCode, this.weiXinLogModel.ErrorTimes + 1);
                this.ErrorNewsHandle("由于您的误操作次数过多,会员申请模式已退出", "您发送的短信验证码有误,请重新发送");
            }
        }
Exemple #10
0
 private void Do2MemberTransform()
 {
     this.Content  = this.xmlDoc.GetElementsByTagName("Content")[0].InnerText.Trim();
     this.memModel = this.memBll.GetModelByMemCard(this.Content);
     if (this.memModel != null)
     {
         this.sendXML = ResponseSendStr.Text(this.postStr, "请发送您的会员卡密码,如果密码为空请回复 # 号");
         this.GiveWeiXinLodAssignment(this.memModel.MemCard, 1, "3", "", 0);
         this.weiXinLogBLL.Update(this.weiXinLogModel);
     }
     else
     {
         Chain.Model.Mem mem = this.memBll.GetModelByMemMobile(this.Content);
         if (mem != null)
         {
             if (PubFunction.curParameter.bolWeiXinSMSVcode)
             {
                 if (PubFunction.curParameter.bolSms)
                 {
                     if (SMSInfo.GetBalance(false) == "0")
                     {
                         string strTemplet = string.Format("由于本系统短信剩余条数不足,无法给您发送短信验证码;\r\n您的会员卡号为:{0}****{1},请发送您的会员卡密码,如果密码为空请回复 # 号", mem.MemCard.Substring(0, 1), mem.MemCard.Substring(mem.MemCard.Length - 1, 1));
                         this.sendXML = ResponseSendStr.Text(this.postStr, strTemplet);
                         this.GiveWeiXinLodAssignment(mem.MemCard, 1, "3", "", 0);
                         this.weiXinLogBLL.Update(this.weiXinLogModel);
                     }
                     else
                     {
                         string smsVCode = this.GetRandomCode();
                         string NewsDesc = string.IsNullOrEmpty(PubFunction.curParameter.strWeiXinShopName) ? "" : PubFunction.curParameter.strWeiXinShopName;
                         NewsDesc = string.Concat(new string[]
                         {
                             "温馨提示,欢迎您申请从商家会员转",
                             NewsDesc,
                             "微信会员,您的",
                             NewsDesc,
                             "微信会员短信验证码是:",
                             smsVCode
                         });
                         this.sendXML = ResponseSendStr.Text(this.postStr, "请发送短信验证码");
                         SMSInfo.Send_GXSMS(false, this.Content, NewsDesc, "");
                         Chain.Model.SmsLog modelSms = new Chain.Model.SmsLog();
                         modelSms.SmsMemID     = Convert.ToInt32(mem.MemID);
                         modelSms.SmsMobile    = this.Content;
                         modelSms.SmsContent   = NewsDesc;
                         modelSms.SmsTime      = DateTime.Now;
                         modelSms.SmsShopID    = 1;
                         modelSms.SmsUserID    = 1;
                         modelSms.SmsAmount    = PubFunction.GetSmsAmount(NewsDesc);
                         modelSms.SmsAllAmount = modelSms.SmsAmount;
                         Chain.BLL.SmsLog bllSms = new Chain.BLL.SmsLog();
                         bllSms.Add(modelSms);
                         this.GiveWeiXinLodAssignment(this.Content, 2, "3", smsVCode, 0);
                         this.weiXinLogBLL.Update(this.weiXinLogModel);
                     }
                 }
                 else
                 {
                     string strTemplet = string.Format("由于本系统短信功能暂未开启,无法给您发送短信验证码;\r\n您的会员卡号为:{0}****{1},请发送您的会员卡密码,如果密码为空请回复 # 号", mem.MemCard.Substring(0, 1), mem.MemCard.Substring(mem.MemCard.Length - 1, 1));
                     this.sendXML = ResponseSendStr.Text(this.postStr, strTemplet);
                     this.GiveWeiXinLodAssignment(mem.MemCard, 1, "3", "", 0);
                     this.weiXinLogBLL.Update(this.weiXinLogModel);
                 }
             }
             else
             {
                 this.memModel = this.memBll.GetMemInfoByMobile(this.Content);
                 this.memModel.MemWeiXinCard = this.FromUserName;
                 this.memBll.Update(this.memModel);
                 this.DoCard("恭喜您已转移成微信会员");
             }
         }
         else
         {
             this.GiveWeiXinLodAssignment(this.weiXinLogModel.RecordContent, this.weiXinLogModel.RecordContentType, this.weiXinLogModel.StatusCode, this.weiXinLogModel.RandomCode, this.weiXinLogModel.ErrorTimes + 1);
             this.ErrorNewsHandle("由于您的错误操作次数过多,转微信会员模式已退出", "您发送的手机号或卡号在系统中没找着,请重新发送");
         }
     }
 }
Exemple #11
0
        private void Do0ForApplicationMember()
        {
            this.Content = this.xmlDoc.GetElementsByTagName("Content")[0].InnerText.Trim();
            if (Regex.IsMatch(this.Content, "^1[3|4|5|8]\\d{9}$"))
            {
                Chain.Model.Mem mem = this.memBll.GetModelByMemMobile(this.Content);
                if (mem != null)
                {
                    this.sendXML = ResponseSendStr.Text(this.postStr, "该手机号已被注册,请重新输入一个新的手机号");
                }
                else if (PubFunction.curParameter.bolWeiXinSMSVcode)
                {
                    if (PubFunction.curParameter.bolSms)
                    {
                        if (SMSInfo.GetBalance(false) == "0")
                        {
                            this.sendXML = ResponseSendStr.Text(this.postStr, "商家短信不足,发送短信验证码失败,请与商家联系");
                            this.weiXinLogBLL.Delete(this.FromUserName);
                        }
                        else
                        {
                            string smsVCode = this.GetRandomCode();
                            string NewsDesc = string.IsNullOrEmpty(PubFunction.curParameter.strWeiXinShopName) ? "" : PubFunction.curParameter.strWeiXinShopName;
                            NewsDesc = string.Concat(new string[]
                            {
                                "温馨提示,欢迎您注册",
                                NewsDesc,
                                "微信会员,您的",
                                NewsDesc,
                                "微信会员短信验证码是:",
                                smsVCode
                            });
                            this.sendXML = ResponseSendStr.Text(this.postStr, "请发送短信验证码");
                            SMSInfo.Send_GXSMS(false, this.Content, NewsDesc, "");
                            Chain.Model.SmsLog modelSms = new Chain.Model.SmsLog();
                            modelSms.SmsMemID     = 0;
                            modelSms.SmsMobile    = this.Content;
                            modelSms.SmsContent   = NewsDesc;
                            modelSms.SmsTime      = DateTime.Now;
                            modelSms.SmsShopID    = 1;
                            modelSms.SmsUserID    = 1;
                            modelSms.SmsAmount    = PubFunction.GetSmsAmount(NewsDesc);
                            modelSms.SmsAllAmount = modelSms.SmsAmount;
                            Chain.BLL.SmsLog bllSms = new Chain.BLL.SmsLog();
                            bllSms.Add(modelSms);
                            this.GiveWeiXinLodAssignment(this.Content, 2, "1", smsVCode, 0);
                            this.weiXinLogBLL.Update(this.weiXinLogModel);
                        }
                    }
                    else
                    {
                        this.sendXML = ResponseSendStr.Text(this.postStr, "系统短信功能暂未开启,发送短信验证码失败,请与商家联系");
                        this.weiXinLogBLL.Delete(this.FromUserName);
                    }
                }
                else
                {
                    int isOk = this.MemRegister(false);
                    if (isOk > 0)
                    {
                        this.DoCard("恭喜您会员卡办理成功");
                    }
                    else
                    {
                        string strErr = "系统错误,会员办卡失败!";
                        int    num    = isOk;
                        if (num != -6)
                        {
                            switch (num)
                            {
                            case -2:
                                strErr = "手机号码重复,会员办卡失败!";
                                break;

                            case -1:
                                strErr = "会员卡号重复,会员办卡失败!";
                                break;
                            }
                        }
                        else
                        {
                            strErr = "卡面号重复,会员办卡失败!";
                        }
                        this.sendXML = ResponseSendStr.Text(this.postStr, strErr);
                    }
                }
            }
            else
            {
                this.GiveWeiXinLodAssignment("", 0, "0", "", this.weiXinLogModel.ErrorTimes + 1);
                this.ErrorNewsHandle("由于您的误操作次数过多,会员申请模式已退出", "您发送的手机号格式有误,请重新发送");
            }
        }