public JsonResult CarouselPictures(CarouselPictureSearchInput input) { var regexImg = new Regex(@"(<img[\s\S]+?src="".+?""){1}"); var regexUrl = new Regex(@"http[\s\S]+?(?="")"); var regexHtmlTag = new Regex(@"[<][\s\S]+?[>]"); using (var result = new ResponseResult <List <CarouselPictureOutput> >()) { long totalCount = 3; List <T_ARTICLE> list = null; if (input.CatId > 1) { list = _article.GetAll(m => !m.IsDeleted && m.CatId == input.CatId && m.IsPutOnCarousel, input.OrderBy, 1, 3, true, out totalCount); } else { list = _article.GetAll(m => !m.IsDeleted && m.IsPutOnCarousel, input.OrderBy, 1, 3, true, out totalCount); } result.Entity = Mapper.Map <List <CarouselPictureOutput> >(list); result.TotalNums = result.Entity.Count; for (int i = 0; i < list.Count; i++) { var item = list[i]; if (!string.IsNullOrEmpty(item.Content)) { var img = regexImg.Match(item.Content).Value; result.Entity[i].PictureUrl = regexUrl.Match(img).Value; } } return(new JsonResultEx(result)); } }
public JsonResult CarouselPictures(CarouselPictureSearchInput input) { var responseResult = RestSharpHelper.PostWithStandard <ResponseResult <List <CarouselPictureOutput> > >(GetCurrentUrl(this), GetPostParameters(), GetCertificationFilePath(), GetCertificationPwd()); if (responseResult.IsSuccess) { if (responseResult.IsSuccess && responseResult.Entity != null) { var articBasePath = ConfigHelper.GetAppSetting(DataKey.ArticleStaticPageBasePath); foreach (var article in responseResult.Entity) { article.ArticleUrl = articBasePath + article.ArticleUrl; } } } return(new JsonResultEx(responseResult)); }