Example #1
0
        // 关注事件
        void service_SubscribeEvent(object sender, WeiXinMessageBase arge)
        {
            string        WeixinTxt = WeiXinProxy.GetResponse(EnumReplyMsgType.Subscribe);
            WeiXinTextMsg TexXml    = new WeiXinTextMsg();

            TexXml.FromUserName = arge.ToUserName;
            TexXml.ToUserName   = arge.FromUserName;
            TexXml.MsgType      = EnumWeiXinMsgType.Text;
            TexXml.Content      = WeixinTxt;
            context.Response.Write(TexXml.ToXML());
        }
Example #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int type = Convert.ToInt32(context.Request.Form["types"]);
            EnumReplyMsgType MsgType = new EnumReplyMsgType();

            MsgType = (EnumReplyMsgType)type;
            string types = WeiXinProxy.GetResponse(MsgType);
            string sss   = "";

            context.Response.Write(types);
        }
Example #3
0
        //接收消息
        void service_ReceiveMsgEvent(object sender, WeiXinMessageBase arge)
        {
            string WeixinTxt = "";

            switch (arge.MsgType)
            {
            case WeiXinJK.Model.EnumWeiXinMsgType.Text:
                WeixinTransfer WXXml = new WeixinTransfer();
                WXXml.ToUserName   = arge.FromUserName;
                WXXml.FromUserName = arge.ToUserName;
                WXXml.MsgType      = EnumWeiXinMsgType.transfer_customer_service;
                context.Response.Write(WXXml.ToXML());
                break;

            case WeiXinJK.Model.EnumWeiXinMsgType.Image:
                WeixinTxt = WeiXinProxy.GetResponse(EnumReplyMsgType.ImgAutoReply);
                break;

            case WeiXinJK.Model.EnumWeiXinMsgType.Voice:
            case WeiXinJK.Model.EnumWeiXinMsgType.Video:
                WeixinTxt = WeiXinProxy.GetResponse(EnumReplyMsgType.VideoAutoReply);
                break;

            case WeiXinJK.Model.EnumWeiXinMsgType.Location:
                WeixinTxt = WeiXinProxy.GetResponse(EnumReplyMsgType.LocationAutoReply);
                break;

            case WeiXinJK.Model.EnumWeiXinMsgType.Link:
                WeixinTxt = WeiXinProxy.GetResponse(EnumReplyMsgType.LinkAutoReply);
                break;

            default:
                WeixinTxt = "哦!太博大精深了。但是我看不懂!!!";
                break;
            }
            if (WeixinTxt != "")
            {
                WeiXinTextMsg TexXml = new WeiXinTextMsg();
                TexXml.ToUserName   = arge.FromUserName;
                TexXml.FromUserName = arge.ToUserName;
                TexXml.MsgType      = EnumWeiXinMsgType.Text;
                TexXml.Content      = WeixinTxt;
                context.Response.Write(TexXml.ToXML());
            }
        }