Ejemplo n.º 1
0
        /// <summary>
        /// 返回图片类型信息
        /// </summary>
        /// <param name="requestMessage"></param>
        /// <param name="responseConfig"></param>
        /// <returns></returns>
        private IResponseMessageBase RenderResponseMessageNoResponse(IRequestMessageBase requestMessage, Response responseConfig, MessageEntityEnlighten enlighten)
        {
            var strongResponseMessage = requestMessage.CreateResponseMessage <ResponseMessageNoResponse>(enlighten);
            var mediaId = NeuralNodeHelper.GetImageMessageMediaId(requestMessage, responseConfig.Content);

            return(strongResponseMessage);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 返回文字类型信息
        /// </summary>
        /// <param name="requestMessage"></param>
        /// <param name="responseConfig"></param>
        /// <returns></returns>
        private IResponseMessageText RenderResponseMessageText(IRequestMessageBase requestMessage, Response responseConfig, MessageEntityEnlighten enlighten)
        {
            var strongResponseMessage = requestMessage.CreateResponseMessage <IResponseMessageText>(enlighten);

            strongResponseMessage.Content = NeuralNodeHelper.FillTextMessage(responseConfig.Content);
            return(strongResponseMessage);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 返回图片类型信息
        /// </summary>
        /// <param name="requestMessage"></param>
        /// <param name="responseConfig"></param>
        /// <returns></returns>
        private IResponseMessageBase RenderResponseMessageImage(IRequestMessageBase requestMessage, Response responseConfig, MessageEntityEnlighten enlighten)
        {
            var strongResponseMessage = requestMessage.CreateResponseMessage <IResponseMessageImage>(enlighten);
            var mediaId = NeuralNodeHelper.GetImageMessageMediaId(requestMessage, responseConfig.Content);

            if (string.IsNullOrEmpty(mediaId))
            {
                var textResponseMessage = requestMessage.CreateResponseMessage <IResponseMessageText>(enlighten);
                textResponseMessage.Content = "消息中未获取到图片信息";
                return(textResponseMessage);
            }
            else
            {
                strongResponseMessage.Image.MediaId = mediaId;
            }


            //TODO:其他情况

            return(strongResponseMessage);
        }
Ejemplo n.º 4
0
        private IResponseMessageBase GetResponseMessage(IRequestMessageBase requestMessage, Response responseConfig, MessageEntityEnlighten enlighten)
        {
            IResponseMessageBase responseMessage = null;

            switch (responseConfig.Type)
            {
            case ResponseMsgType.Text:
                responseMessage = RenderResponseMessageText(requestMessage, responseConfig, enlighten);
                break;

            case ResponseMsgType.News:
                break;

            case ResponseMsgType.Music:
                break;

            case ResponseMsgType.Image:
                responseMessage = RenderResponseMessageImage(requestMessage, responseConfig, enlighten);
                break;

            case ResponseMsgType.Voice:
                break;

            case ResponseMsgType.Video:
                break;

            case ResponseMsgType.Transfer_Customer_Service:
                break;

            case ResponseMsgType.MultipleNews:
                break;

            case ResponseMsgType.LocationMessage:
                break;

            case ResponseMsgType.NoResponse:
                responseMessage = RenderResponseMessageNoResponse(requestMessage, responseConfig, enlighten);
                break;

            case ResponseMsgType.SuccessResponse:
                break;

            default:
                break;
            }
            return(responseMessage);
        }