public JsonResult EditSlideImage(SlideAdInfo slideAdInfo) { slideAdInfo.TypeId = SlideAdInfo.SlideAdType.VShopHome; slideAdInfo.ShopId = CurrentSellerManager.ShopId; if (slideAdInfo.Id > 0) { _iSlideAdsService.UpdateSlidAd(slideAdInfo); } else { _iSlideAdsService.AddSlidAd(slideAdInfo); } return(Json(new { success = true })); }
public JsonResult EditSlideAd(long id, string pic, string url) { var slide = _iSlideAdsService.GetSlidAd(0, id); if (!string.IsNullOrWhiteSpace(pic) && (!slide.ImageUrl.Equals(pic))) { if (pic.Contains("/temp/")) { string source = pic.Substring(pic.LastIndexOf("/temp/")); string dest = @"/Storage/Plat/ImageAd/"; pic = dest + Path.GetFileName(pic); Core.HimallIO.CopyFile(source, pic, true); } else if (pic.Contains("/Storage/")) { pic = pic.Substring(pic.LastIndexOf("/Storage/")); } } _iSlideAdsService.UpdateSlidAd(new SlideAdInfo { Id = id, ImageUrl = pic, Url = url }); return(Json(new { successful = true }, JsonRequestBehavior.AllowGet)); }
public JsonResult EditSlideAd(long id, string pic, string url) { SlideAdInfo slidAd = ServiceHelper.Create <ISlideAdsService>().GetSlidAd(0, id); if (!string.IsNullOrWhiteSpace(pic) && !slidAd.ImageUrl.Equals(pic)) { string str = Server.MapPath(pic); string str1 = "/Storage/Plat/ImageAd/"; string mapPath = IOHelper.GetMapPath(str1); if (!Directory.Exists(mapPath)) { Directory.CreateDirectory(mapPath); } IOHelper.CopyFile(str, Server.MapPath(str1), true, ""); pic = Path.Combine(str1, Path.GetFileName(str)); } ISlideAdsService slideAdsService = ServiceHelper.Create <ISlideAdsService>(); SlideAdInfo slideAdInfo = new SlideAdInfo() { Id = id, ImageUrl = pic, Url = url }; slideAdsService.UpdateSlidAd(slideAdInfo); return(Json(new { successful = true }, JsonRequestBehavior.AllowGet)); }
public JsonResult EditSlideAd(long id, string pic, string url) { var slide = _iSlideAdsService.GetSlidAd(0, id); if (!string.IsNullOrWhiteSpace(pic) && (!slide.ImageUrl.Equals(pic))) { if (pic.Contains("/temp/")) { string source = pic.Substring(pic.LastIndexOf("/temp")); string dest = @"/Storage/Plat/ImageAd/"; pic = Path.Combine(dest, Path.GetFileName(source)); Core.MallIO.CopyFile(source, pic, true); } else if (pic.Contains("/Storage/")) { pic = pic.Substring(pic.LastIndexOf("/Storage/")); } } _iSlideAdsService.UpdateSlidAd(new Entities.SlideAdInfo { Id = id, ImageUrl = pic, Url = url }); return(Json(new Result { success = true })); }
/// <summary> /// 添加轮播图 /// </summary> /// <param name="id"></param> /// <param name="description"></param> /// <param name="imageUrl"></param> /// <param name="url"></param> /// <returns></returns> public JsonResult AddSlideImage(string id, string description, string imageUrl, string url) { if (imageUrl.Contains("/temp/")) { string source = imageUrl.Substring(imageUrl.LastIndexOf("/temp/")); string dest = @"/Storage/Plat/APP/SlidAd/"; imageUrl = dest + Path.GetFileName(imageUrl); Core.HimallIO.CopyFile(source, imageUrl, true); } else if (imageUrl.Contains("/Storage/")) { imageUrl = imageUrl.Substring(imageUrl.LastIndexOf("/Storage/")); } Result result = new Result(); var slideAdInfo = new SlideAdInfo(); slideAdInfo.Id = Convert.ToInt64(id); slideAdInfo.ImageUrl = imageUrl; slideAdInfo.TypeId = SlideAdInfo.SlideAdType.DistributionHome; slideAdInfo.Url = url.ToLower().Replace("/m-wap", "/m-ios").Replace("/m-weixin", "/m-ios"); slideAdInfo.Description = description; slideAdInfo.ShopId = 0; if (slideAdInfo.Id > 0) { _iSlideAdsService.UpdateSlidAd(slideAdInfo); } else { _iSlideAdsService.AddSlidAd(slideAdInfo); } result.success = true; return(Json(result)); }
public JsonResult AddSlideImage(string id, string description, string imageUrl, string url, int slideTypeId) { Result result = new Result(); var slideAdInfo = new Entities.SlideAdInfo(); slideAdInfo.Id = Convert.ToInt64(id); slideAdInfo.ImageUrl = imageUrl; slideAdInfo.TypeId = (Entities.SlideAdInfo.SlideAdType)slideTypeId; slideAdInfo.Url = url.ToLower(); slideAdInfo.Description = description; slideAdInfo.ShopId = 0; if (slideAdInfo.Id > 0) { _iSlideAdsService.UpdateSlidAd(slideAdInfo); } else { _iSlideAdsService.AddSlidAd(slideAdInfo); } result.success = true; return(Json(result)); }
public JsonResult SaveSlideImage(long?id, string imageUrl, string url) { Entities.SlideAdInfo slideImageIfo = new Entities.SlideAdInfo(); slideImageIfo.ImageUrl = imageUrl; slideImageIfo.Url = url; slideImageIfo.ShopId = CurrentSellerManager.ShopId; slideImageIfo.TypeId = Entities.SlideAdInfo.SlideAdType.VShopHome; if (id.HasValue) { slideImageIfo.Id = id.Value; _iSlideAdsService.UpdateSlidAd(slideImageIfo); } else { _iSlideAdsService.AddSlidAd(slideImageIfo); } return(Json(new { success = true })); }
public JsonResult SaveSlideAd(long?id, string pic, string url) { var slide = new Entities.SlideAdInfo() { ImageUrl = pic, Url = url, ShopId = CurrentSellerManager.ShopId, DisplaySequence = 0, Id = id.GetValueOrDefault(), TypeId = Entities.SlideAdInfo.SlideAdType.ShopHome }; if (!string.IsNullOrWhiteSpace(pic) && pic.Contains("/temp/")) { string dest = string.Format(@"/Storage/Shop/{0}/ImageAd/", CurrentSellerManager.ShopId); var destimg = slide.ImageUrl = Path.Combine(dest, Path.GetFileName(pic)); var source = pic.Substring(pic.LastIndexOf("/temp/")); Core.HimallIO.CopyFile(source, destimg, true); slide.ImageUrl = destimg; } else if (pic.Contains("/Storage/")) { slide.ImageUrl = pic.Substring(pic.LastIndexOf("/Storage/")); } else { slide.ImageUrl = ""; } if (id.HasValue) { _iSlideAdsService.UpdateSlidAd(slide); } else { _iSlideAdsService.AddSlidAd(slide); } ClearCache(); return(Json(new { success = true, imageUrl = slide.ImageUrl })); }
public JsonResult AppAddSlideImage(string id, string description, string imageUrl, string url) { Result result = new Result(); var slideAdInfo = new SlideAdInfo(); slideAdInfo.Id = Convert.ToInt64(id); slideAdInfo.TypeId = SlideAdInfo.SlideAdType.AppGifts; slideAdInfo.Url = url.ToLower().Replace("/m-wap", "/m-app").Replace("/m-weixin", "/m-app"); slideAdInfo.Description = description; slideAdInfo.ShopId = 0; slideAdInfo.ImageUrl = imageUrl; if (slideAdInfo.Id > 0) { _iSlideAdsService.UpdateSlidAd(slideAdInfo); } else { _iSlideAdsService.AddSlidAd(slideAdInfo); } result.success = true; return(Json(result)); }
/// <summary> /// 更新一个自动轮播广告图片 /// </summary> /// <param name="models"></param> public static SlideAdInfo UpdateSlidAd(SlideAdInfo models) { return(_iSlideAdsService.UpdateSlidAd(models)); }