Esempio n. 1
0
 private string WxVoiceAnalytical(WxXmlModel wxXmlModel, string token, string wxToken)
 {
     Console.WriteLine("WxVoiceAnalytical_Recognition>>" + wxXmlModel.Recognition);
     // string url = string.Format(WechatGetMediaUrl, wxToken, wxXmlModel.MediaId);
     if (string.IsNullOrEmpty(wxXmlModel.Recognition))
     {
         wxXmlModel.Content = "无法识别您说的话哦,请在说一遍";
     }
     else if (wxXmlModel.Recognition.Contains("是什么垃圾"))
     {
         string rubbishName = DisposeName(wxXmlModel.Recognition, "是什么垃圾");
         wxXmlModel.Content = RubbishDispose(rubbishName);
     }
     else if (IsAddRubbishType(wxXmlModel.Recognition))
     {
         wxXmlModel.Content = AddRubbish(wxXmlModel.Recognition);
     }
     else
     {
         if (!LoveLan.IsWXLoveLan(ref wxXmlModel))
         {
             wxXmlModel.Content = UNIT.GetResponseMessage(wxXmlModel.Recognition, wxXmlModel.FromUserName, token);
         }
     }
     return(WeChatXml.ResponseXML(wxXmlModel));
 }
Esempio n. 2
0
        public string WxImageAnalytical(WxXmlModel wxXmlModel, string token, string wxToken)
        {
            string url = string.Format(WechatGetMediaUrl, wxToken, wxXmlModel.MediaId);

            byte[] data = NetHelper.HttpGetByte(url);
            wxXmlModel.Content = UNIT.GetImageDisposeStr(data, token);
            wxXmlModel.MsgType = "text";
            return(WeChatXml.ResponseXML(wxXmlModel));
        }
Esempio n. 3
0
        /// <summary>
        /// 发送消息测试
        /// </summary>
        public static void SendMessage()
        {
            WeixinAuthResult token      = WeixinAuth.GetToken();
            string           host       = @"https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" + token.access_token;
            WxXmlModel       wxXmlModel = new WxXmlModel()
            {
                FromUserName = "******",
                Content      = "测试",
            };
            string ss = WeChatXml.ResponseXML(wxXmlModel);//回复消息

            NetHelper.HttpPost(host, ss);
        }
Esempio n. 4
0
 private string WxTextAnalytical(WxXmlModel wxXmlModel, string token)
 {
     Console.WriteLine("WxTextAnalytical_Content>>" + wxXmlModel.Content);
     if (!string.IsNullOrEmpty(wxXmlModel.Content))
     {
         if (!LoveLan.IsWXLoveLan(ref wxXmlModel))
         {
             if (wxXmlModel.Content.Contains("是什么垃圾"))
             {
                 string rubbishName = DisposeName(wxXmlModel.Content, "是什么垃圾");
                 wxXmlModel.Content = RubbishDispose(rubbishName);
             }
             else if (IsAddRubbishType(wxXmlModel.Content))
             {
                 wxXmlModel.Content = AddRubbish(wxXmlModel.Content);
             }
             else
             {
                 wxXmlModel.Content = UNIT.GetResponseMessage(wxXmlModel.Content, wxXmlModel.FromUserName, token);
             }
         }
     }
     return(WeChatXml.ResponseXML(wxXmlModel));
 }