public static List <Article> CreateResponse(List <ArticleInfoView> articles, string host, string baseUrl)
        {
            // var responseMessage = this.CreateResponseMessage<ResponseMessageNews>();
            var Articles = new List <Article>();
            int i        = 0;

            foreach (var a in articles)
            {
                //string imgUrl;

                //if (a.ThumbImageId == null)
                //{
                //    log.Error("Not found Image!");
                //    imgUrl = _newsHost + "/Content/img/LogoRed.png";
                //}
                //else
                //{
                //    imgUrl = string.Format("{0}{1}", _newsHost, a.ImageCoverUrl);
                //}

                var imgUrl = "";
                if (0 == i)
                {
                    //不存在就创建
                    imgUrl = WechatCommon.doGetFileCover(a.ImageCoverUrl, "_B");
                }
                else
                {
                    imgUrl = WechatCommon.doGetFileCover(a.ImageCoverUrl, "_T");
                }

                i++;

                var newArticle = new Article()
                {
                    Title       = a.ArticleTitle,
                    Url         = host + baseUrl + a.Id,
                    PicUrl      = _newsHost + imgUrl,
                    Description = a.ArticleComment
                };
                log.Debug("Creating News - \r\n\tTitle: " + newArticle.Title + "\r\n\tUrl: " + newArticle.Url + "\r\n\tPush Image: " + newArticle.PicUrl);

                Articles.Add(newArticle);
            }
            return(Articles);
        }
        public static List <object> CreateNewsResponseMessage(AutoReplyContentView content, int appId, bool isCorp, bool isSafe, bool isAutoReply = false)
        {
            // var photoTextMsg = this.CreateResponseMessage<ResponseMessageNews>();
            var Articles = new List <object>();

            if (content.IsNewContent.Value)
            {
                var info    = JsonConvert.DeserializeObject <List <NewsInfoView> >(content.Content);
                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 = Infrastructure.Web.Domain.Service.CommonService.GetSysConfig("Content Server", "").TrimEnd('/');// config.ConfigValue;
                //if (host.EndsWith("/"))
                //{
                //    host = host.Substring(0, host.Length - 1);
                //}

                int ii = 0;
                foreach (var entity in info)
                {
                    if (ii == 0) //位置不同,缩略图的比例不一样
                    {
                        entity.ImageSrc = WechatCommon.doGetFileCover(entity.ImageSrc, "_B");
                    }
                    else
                    {
                        entity.ImageSrc = WechatCommon.doGetFileCover(entity.ImageSrc, "_T");
                    }

                    ii++;

                    var picUrl = host + entity.ImageSrc;
                    //var url = host + "/News/ArticleInfo/wxdetail/" + content.AutoReplyId + "?wechatid=" + appId;// "&subId=" + item.Id;
                    var url = string.Format("{0}/{1}/Message/GetNews?id={2}&wechatid={2}&type={3}&subId={4}", host, isCorp ? "news" : "mpnews",
                                            content.AutoReplyId, appId, (int)NewsTypeEnum.AutoReply, entity.Id); //host + "/News/Message/GetNews?id=" + content.AutoReplyId + "&wechatid=" + appId + "&type=" + (int)NewsTypeEnum.AutoReply;
                    var newArticle = new Article()
                    {
                        Title       = entity.NewsTitle,
                        Url         = url,
                        PicUrl      = picUrl,
                        Description = entity.NewsComment
                    };
                    Articles.Add(newArticle);
                }
            }
            else
            {
                List <ArticleInfoView> articleList = new List <ArticleInfoView>();
                if (content.SecondaryType == (int)AutoReplyNewsEnum.MANUAL)
                {
                    List <int> articleIds = content.NewsID.Trim(',').Split(',').ToList().Select(n => int.Parse(n)).ToList();
                    if (articleIds.Count > 0)
                    {
                        log.Debug("article count :{0}.", articleIds.Count);
                        var lst = ((DbSet <ArticleInfo>)_articleInfoService.Repository.Entities).AsNoTracking()
                                  .Where(t => t.AppId == appId && articleIds.Contains(t.Id) && t.IsDeleted == false).ToList()
                                  .Select(a => (ArticleInfoView) new ArticleInfoView().ConvertAPIModelListWithContent(a)).ToList();

                        //解决顺序问题
                        foreach (var aID in articleIds)
                        {
                            var al = lst.Find(a => a.Id == aID);
                            if (al != null)
                            {
                                articleList.Add(al);
                            }
                        }
                    }
                }
                else if (content.SecondaryType == (int)AutoReplyNewsEnum.LATEST)
                {
                    articleList.AddRange(((DbSet <ArticleInfo>)_articleInfoService.Repository.Entities).AsNoTracking()
                                         .Where(t => t.AppId == appId && t.IsDeleted == false)
                                         .OrderBy("Id", System.ComponentModel.ListSortDirection.Descending)
                                         .Take(int.Parse(content.Content)).ToList()
                                         .Select(a => (ArticleInfoView) new ArticleInfoView().ConvertAPIModelListWithContent(a)).ToList());
                }
                ;

                // articleList = articleList.Distinct().OrderByDescending(t => t.PublishDate).ToList();

                var token = WeChatCommonService.GetWeiXinToken(appId);
                int ii    = 0;
                foreach (var a in articleList)
                {
                    log.Debug("Start ID:{0} ImageCoverUrl:{1} ", a.Id, a.ImageCoverUrl);

                    if (ii == 0) //位置不同,缩略图的比例不一样
                    {
                        a.ImageCoverUrl = WechatCommon.doGetFileCover(a.ImageCoverUrl, "_B");
                    }
                    else
                    {
                        a.ImageCoverUrl = WechatCommon.doGetFileCover(a.ImageCoverUrl, "_T");
                    }

                    ii++;


                    if (isSafe)
                    {
                        var newArticle = new MpNewsArticle()
                        {
                            title = a.ArticleTitle,
                            content_source_url = string.Format("{0}/{3}/ArticleInfo/wxdetail/{1}?wechatid={2}&isAutoReply={4}", _newsHost, a.Id, appId, isCorp ? "news" : "mpnews", isAutoReply ? 1 : 0),// _newsHost + "/News/ArticleInfo/wxdetail/" + a.Id + "?wechatid=" + appId,
                            //content = _newsHost + a.ImageCoverUrl,
                            digest         = a.ArticleComment,
                            content        = a.ArticleContent,// WechatCommonMP.ImageConvert(a.ArticleContent, appId),
                            author         = a.CreatedUserID,
                            show_cover_pic = "0",
                            thumb_media_id = WechatCommon.GetMediaId(a.ImageCoverUrl, token)
                        };
                        log.Debug("Creating MPNews - \r\n\tTitle: " + newArticle.title + "\r\n\tUrl: " + newArticle.content_source_url + "\r\n\tPush Image: " + newArticle.thumb_media_id);
                        Articles.Add(newArticle);
                    }
                    else
                    {
                        var newArticle = new Article()
                        {
                            Title       = a.ArticleTitle,
                            Url         = string.Format("{0}/{3}/ArticleInfo/wxdetail/{1}?wechatid={2}&isAutoReply={4}", _newsHost, a.Id, appId, isCorp ? "news" : "mpnews", isAutoReply ? 1 : 0),// _newsHost + "/News/ArticleInfo/wxdetail/" + a.Id + "?wechatid=" + appId,
                            PicUrl      = _newsHost + a.ImageCoverUrl.Replace("\\", "/").TrimStart('/'),
                            Description = a.ArticleComment
                        };
                        log.Debug("Creating News - \r\n\tTitle: " + newArticle.Title + "\r\n\tUrl: " + newArticle.Url + "\r\n\tPush Image: " + newArticle.PicUrl);
                        Articles.Add(newArticle);
                    }
                }
            }

            return(Articles);
        }