/// <summary>
        /// 处理请求消息
        /// </summary>
        /// <returns>处理结果</returns>
        public ResponseMessage HandlerRequestMessage()
        {
            Dictionary <string, object> bugobj = new Dictionary <string, object>();
            ResponseTextMessage         responseTextMessage = null;
            var request = new RequestQREventMessage(this.message.Element);

            try
            {
                if (request != null)
                {
                    // 处理扫描带参数的二维码消息处理器
                    //  bugobj.Add("处理扫描带参数的二维码消息处理器", request);
                }
                responseTextMessage = new ResponseTextMessage(request)
                {
                    Content = subScribeMsg,
                };
            }
            catch (Exception ex)
            {
                TxtLogHelper.WriteLog_Day(new TxtLogInfoObject()
                {
                    LogType    = EnumLogType.Error,
                    LogMessage = string.Format("错误信息{0};堆栈信息{1}", ex.Message, ex.StackTrace),
                });
            }
            finally
            {
                TxtLogHelper.WriteDebugLog(bugobj);
            }

            return(responseTextMessage);
        }
        /// <summary>
        /// 处理请求消息
        /// </summary>
        /// <returns>处理结果</returns>
        public ResponseMessage HandlerRequestMessage()
        {
            Dictionary<string, object> bugobj = new Dictionary<string, object>();
            ResponseTextMessage responseTextMessage = null;
            var request = new RequestQREventMessage(this.message.Element);
            try
            {
                if (request != null)
                {
                    // 处理扫描带参数的二维码消息处理器
                    //  bugobj.Add("处理扫描带参数的二维码消息处理器", request);
                }
                responseTextMessage = new ResponseTextMessage(request)
                {
                    Content = subScribeMsg,
                };
            }
            catch (Exception ex)
            {
                TxtLogHelper.WriteLog_Day(new TxtLogInfoObject()
                {
                    LogType = EnumLogType.Error,
                    LogMessage = string.Format("错误信息{0};堆栈信息{1}", ex.Message, ex.StackTrace),
                });
            }
            finally
            {
                TxtLogHelper.WriteDebugLog(bugobj);
            }

            return responseTextMessage;
        }
Пример #3
0
        /// <summary>
        /// 语音识别处理
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        public ResponseMessage HandlerRequestMessage()
        {
            Dictionary<string, object> bugobj = new Dictionary<string, object>();
            var request = this.msghander.RequestMessage as RequestVoiceMessage;
            var responseText = new ResponseTextMessage(request);
            try
            {
                bugobj.Add("语音识别处理!", "语音识别处理");
                if (request != null)
                {
                    bugobj.Add("语音识别结果", request);
                    if (!String.IsNullOrEmpty(request.Recognition))
                    {
                        if (!string.IsNullOrEmpty(request.FromUserName))
                        {

                        }
                        else
                        {
                            responseText.Content = "信息格式不正确。";
                        }

                    }
                    else
                    {
                        responseText.Content = "您说的啥?我没听懂";
                    }
                }
                else
                {
                    responseText.Content = "我暂时还无法理解你所说的意思。";
                }
            }
            catch (Exception ex)
            {
                TxtLogHelper.WriteLog_Day(new TxtLogInfoObject()
                {
                    LogType = EnumLogType.Error,
                    LogMessage = string.Format("错误信息{0};堆栈信息{1}", ex.Message, ex.StackTrace),
                });
            }
            finally
            {
                TxtLogHelper.WriteDebugLog(bugobj);
            }

            return responseText;
        }
Пример #4
0
        /// <summary>
        /// 语音识别处理
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        public ResponseMessage HandlerRequestMessage()
        {
            Dictionary <string, object> bugobj = new Dictionary <string, object>();
            var request      = this.msghander.RequestMessage as RequestVoiceMessage;
            var responseText = new ResponseTextMessage(request);

            try
            {
                bugobj.Add("语音识别处理!", "语音识别处理");
                if (request != null)
                {
                    bugobj.Add("语音识别结果", request);
                    if (!String.IsNullOrEmpty(request.Recognition))
                    {
                        if (!string.IsNullOrEmpty(request.FromUserName))
                        {
                        }
                        else
                        {
                            responseText.Content = "信息格式不正确。";
                        }
                    }
                    else
                    {
                        responseText.Content = "您说的啥?我没听懂";
                    }
                }
                else
                {
                    responseText.Content = "我暂时还无法理解你所说的意思。";
                }
            }
            catch (Exception ex)
            {
                TxtLogHelper.WriteLog_Day(new TxtLogInfoObject()
                {
                    LogType    = EnumLogType.Error,
                    LogMessage = string.Format("错误信息{0};堆栈信息{1}", ex.Message, ex.StackTrace),
                });
            }
            finally
            {
                TxtLogHelper.WriteDebugLog(bugobj);
            }

            return(responseText);
        }
Пример #5
0
        public ResponseMessage HandlerRequestMessage()
        {
            var request = this.msghander.RequestMessage as RequestTextMessage;
            var responseText = new ResponseTextMessage(request);
            Dictionary<string, object> bugobj = new Dictionary<string, object>();
            try
            {
                bugobj.Add("文字处理!", "文字处理");
                if (request != null)
                {
                    if (!String.IsNullOrEmpty(request.Content))
                    {
                        if (!string.IsNullOrEmpty(request.FromUserName))
                        {
                            // 关键字搜索
                            bugobj.Add("关键字搜索", request.Content);
                            if (request.Content.Contains("笑话"))
                            {
                                List<MQiushibaike> qiushibaikelist = JsonConvert.DeserializeObject<List<MQiushibaike>>(QiushibaikeHelper.GetJokesByRandom());
                                bugobj.Add("笑话", qiushibaikelist);
                                if (qiushibaikelist != null)
                                {
                                    int index = 0;
                                    foreach (var item in qiushibaikelist)
                                    {
                                        if (index == qiushibaikelist.Count - 1)
                                        {
                                            responseText.Content += string.Format(" {0} ---来源:@糗事百科 {1}", item.JokeContent, item.JokerName);
                                        }
                                        else
                                        {
                                            responseText.Content += string.Format(" {0} ---来源:@糗事百科 {1} {2}", item.JokeContent, item.JokerName, "-----我是分割线-----");
                                        }

                                        index++;
                                    }
                                }
                                else
                                {
                                    responseText.Content = "你在逗我?";
                                }
                            }
                        }
                        else
                        {
                            responseText.Content = "你在逗我?";
                        }

                    }
                    else
                    {
                        responseText.Content = "你在逗我?";
                    }
                }
                else
                {
                    responseText.Content = "你在逗我?";
                }
            }
            catch (Exception ex)
            {
                TxtLogHelper.WriteLog_Day(new TxtLogInfoObject()
                {
                    LogType = EnumLogType.Error,
                    LogMessage = string.Format("错误信息{0};堆栈信息{1}", ex.Message, ex.StackTrace),
                });
            }
            finally
            {
                TxtLogHelper.WriteDebugLog(bugobj);
            }

            if (!string.IsNullOrEmpty(this.Message))
            {
                responseText.Content = this.Message;
            }
            return responseText;
        }
Пример #6
0
        public ResponseMessage HandlerRequestMessage()
        {
            var request      = this.msghander.RequestMessage as RequestTextMessage;
            var responseText = new ResponseTextMessage(request);
            Dictionary <string, object> bugobj = new Dictionary <string, object>();

            try
            {
                bugobj.Add("文字处理!", "文字处理");
                if (request != null)
                {
                    if (!String.IsNullOrEmpty(request.Content))
                    {
                        if (!string.IsNullOrEmpty(request.FromUserName))
                        {
                            // 关键字搜索
                            bugobj.Add("关键字搜索", request.Content);
                            if (request.Content.Contains("笑话"))
                            {
                                List <MQiushibaike> qiushibaikelist = JsonConvert.DeserializeObject <List <MQiushibaike> >(QiushibaikeHelper.GetJokesByRandom());
                                bugobj.Add("笑话", qiushibaikelist);
                                if (qiushibaikelist != null)
                                {
                                    int index = 0;
                                    foreach (var item in qiushibaikelist)
                                    {
                                        if (index == qiushibaikelist.Count - 1)
                                        {
                                            responseText.Content += string.Format(" {0} ---来源:@糗事百科 {1}", item.JokeContent, item.JokerName);
                                        }
                                        else
                                        {
                                            responseText.Content += string.Format(" {0} ---来源:@糗事百科 {1} {2}", item.JokeContent, item.JokerName, "-----我是分割线-----");
                                        }

                                        index++;
                                    }
                                }
                                else
                                {
                                    responseText.Content = "你在逗我?";
                                }
                            }
                        }
                        else
                        {
                            responseText.Content = "你在逗我?";
                        }
                    }
                    else
                    {
                        responseText.Content = "你在逗我?";
                    }
                }
                else
                {
                    responseText.Content = "你在逗我?";
                }
            }
            catch (Exception ex)
            {
                TxtLogHelper.WriteLog_Day(new TxtLogInfoObject()
                {
                    LogType    = EnumLogType.Error,
                    LogMessage = string.Format("错误信息{0};堆栈信息{1}", ex.Message, ex.StackTrace),
                });
            }
            finally
            {
                TxtLogHelper.WriteDebugLog(bugobj);
            }

            if (!string.IsNullOrEmpty(this.Message))
            {
                responseText.Content = this.Message;
            }
            return(responseText);
        }