コード例 #1
0
        private IResponseMessageBase CreateLinkeResponseMessage(AutoReplyContentView content)
        {
            var testMsg = this.CreateResponseMessage <ResponseMessageText>();

            testMsg.Content = CustomMessageCommon.CreateLinkResponseMessage(content);
            log.Debug("Create link response :{0}", content);
            return(testMsg);
        }
コード例 #2
0
        private IResponseMessageBase CreateImageResponseMessage(AutoReplyContentView content)
        {
            var imageMsg = this.CreateResponseMessage <ResponseMessageImage>();

            //var image = JsonConvert.DeserializeObject<List<NewsInfoView>>(content.Content)[0];
            //imageMsg.Image = new Image() { MediaId = image.MediaId };

            imageMsg.Image = CustomMessageCommon.CreateImageResponseMessage(content, _postModel.CorpId);

            return(imageMsg);
        }
コード例 #3
0
        private IResponseMessageBase CreateTextResponseMessage(AutoReplyContentView content)
        {
            var testMsg = this.CreateResponseMessage <ResponseMessageText>();

            //var info = JsonConvert.DeserializeObject<List<NewsInfoView>>(content.Content);
            //testMsg.Content = info[0].NewsContent;

            testMsg.Content = CustomMessageCommon.CreateTextResponseMessage(content);

            log.Debug("Create text response :{0}", content);
            return(testMsg);
        }
コード例 #4
0
        private IResponseMessageBase CreateVideoResponseMessage(AutoReplyContentView content)
        {
            var videoMsg = this.CreateResponseMessage <ResponseMessageVideo>();



            //var video = JsonConvert.DeserializeObject<List<NewsInfoView>>(content.Content)[0];
            //videoMsg.Video = new Video()
            //{
            //    Title = video.NewsTitle,
            //    Description = video.NewsComment,
            //    MediaId = video.MediaId,
            //};

            videoMsg.Video = CustomMessageCommon.CreateVideoResponseMessage(content, _postModel.CorpId);
            log.Debug("ResponseMessageVideo Type:{0}", videoMsg.MsgType.ToString());
            return(videoMsg);
        }
コード例 #5
0
        private IResponseMessageBase CreateNewsResponseMessage(AutoReplyContentView content, int appId)
        {
            var photoTextMsg = this.CreateResponseMessage <ResponseMessageNews>();
            var list         = CustomMessageCommon.CreateNewsResponseMessage(content, appId, false, false, true);

            photoTextMsg.Articles = list.Select(a => (Article)a).ToList();

            //photoTextMsg.Articles = new List<Article>();

            //var info = JsonConvert.DeserializeObject<List<NewsInfoView>>(content.Content)[0];
            //var configs = Infrastructure.Web.Domain.Service.CommonService.lstSysConfig;
            //var config = configs.Where(a => a.ConfigName.Equals("Content Server", StringComparison.CurrentCultureIgnoreCase)).First();
            //var contentConfig = configs.Where(a => a.ConfigName.Equals("Content Server", StringComparison.CurrentCultureIgnoreCase)).First();
            //string host = config.ConfigValue;
            //if (host.EndsWith("/"))
            //{
            //    host = host.Substring(0, host.Length - 1);
            //}
            //string contentHost = contentConfig.ConfigValue;
            //if (contentHost.EndsWith("/"))
            //{
            //    contentHost = contentHost.Substring(0, contentHost.Length - 1);
            //}
            //var picUrl = contentHost + info.ImageSrc;
            //var url = host + "/MPNews/ArticleInfo/GetNews?id=" + content.AutoReplyId +"&type="+(int)NewsTypeEnum.AutoReply + "&wechatid=" + appId;// "&subId=" + item.Id;
            //var newArticle = new Article()
            //{
            //    Title = info.NewsTitle,
            //    Url = url,
            //    PicUrl = picUrl,
            //    Description = info.NewsComment
            //};
            //photoTextMsg.Articles.Add(newArticle);

            return(photoTextMsg);
        }