Beispiel #1
0
        public JsonResult UpdateImageAd(long id, string pic, string url)
        {
            var image = SlideApplication.GetImageAd(0, id);

            if (!string.IsNullOrWhiteSpace(pic) && (!image.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"));
                }
            }
            var imageAd = new Entities.ImageAdInfo {
                ShopId = 0, Url = url, ImageUrl = pic, Id = id
            };

            SlideApplication.UpdateImageAd(imageAd);
            return(Json(new Result {
                success = true
            }));
        }
Beispiel #2
0
        public JsonResult GetImageAd(long id)
        {
            var models = SlideApplication.GetImageAd(0, id);

            return(Json(new { success = true, imageUrl = Core.MallIO.GetImagePath(models.ImageUrl), url = models.Url }));
        }
        public JsonResult GetImageAd(long id)
        {
            var models = SlideApplication.GetImageAd(0, id);

            return(Json(new { success = true, imageUrl = Core.HimallIO.GetImagePath(models.ImageUrl), url = models.Url }, JsonRequestBehavior.AllowGet));
        }