public JsonResult GetImageAd(long id)
        {
            var model = _iSlideAdsService.GetSlidAd(0, id);

            if (null != model)
            {
                return(Json(new { success = true, imageUrl = Core.HimallIO.GetImagePath(model.ImageUrl), url = model.Url }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { success = false, msg = "未获取到项目" }, 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 = 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));
        }
예제 #3
0
        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
            }));
        }
예제 #4
0
        public JsonResult GetSlideImages()
        {
            SlideAdInfo[]    array           = ServiceHelper.Create <ISlideAdsService>().GetSlidAds(base.CurrentSellerManager.ShopId, SlideAdInfo.SlideAdType.VShopHome).ToArray();
            ISlideAdsService slideAdsService = ServiceHelper.Create <ISlideAdsService>();
            var collection = array.Select((SlideAdInfo item) => {
                slideAdsService.GetSlidAd(CurrentSellerManager.ShopId, item.Id);
                return(new { id = item.Id, image = item.ImageUrl, displaySequence = (item.DisplaySequence == 0 ? "0" : item.DisplaySequence.ToString()), url = item.Url });
            });

            return(Json(new { rows = collection, total = 100 }, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        public JsonResult GetSlideImages()
        {
            SlideAdInfo[]    array           = ServiceHelper.Create <ISlideAdsService>().GetSlidAds(0, SlideAdInfo.SlideAdType.IOSShopHome).ToArray();
            ISlideAdsService slideAdsService = ServiceHelper.Create <ISlideAdsService>();
            var collection = array.Select((SlideAdInfo item) => {
                slideAdsService.GetSlidAd(0, item.Id);
                return(new { id = item.Id, imgUrl = item.ImageUrl, displaySequence = item.DisplaySequence, url = item.Url, description = item.Description });
            });

            return(Json(new { rows = collection, total = 100 }, JsonRequestBehavior.AllowGet));
        }
예제 #6
0
        public JsonResult GetSlideImages()
        {
            SlideAdInfo[]    source            = this._iSlideAdsService.GetSlidAds(0L, SlideAdInfo.SlideAdType.IOSShopHome).ToArray <SlideAdInfo>();
            ISlideAdsService slideImageService = this._iSlideAdsService;
            var enumerable = source.Select(delegate(SlideAdInfo item)
            {
                SlideAdInfo slidAd = slideImageService.GetSlidAd(0L, item.Id);
                return(new { id = item.Id, imgUrl = HimallIO.GetImagePath(item.ImageUrl, null), displaySequence = item.DisplaySequence, url = item.Url, description = item.Description });
            });

            return(base.Json(new { rows = enumerable, total = 100 }, JsonRequestBehavior.AllowGet));
        }
예제 #7
0
 public JsonResult GetSlideImage(long?id)
 {
     Entities.SlideAdInfo slideImageIfo;
     if (id.HasValue)
     {
         slideImageIfo          = _iSlideAdsService.GetSlidAd(CurrentSellerManager.ShopId, id.Value);
         slideImageIfo.ImageUrl = HimallIO.GetImagePath(slideImageIfo.ImageUrl);
     }
     else
     {
         slideImageIfo = new Entities.SlideAdInfo();
     }
     return(Json(new { success = true, item = slideImageIfo }));
 }
예제 #8
0
        /// <summary>
        /// 更专图片设置
        /// </summary>
        /// <returns></returns>
        public ActionResult SlideImageSettings()
        {
            SlideAdInfo[]    slideAdInfoArray  = Enumerable.ToArray <SlideAdInfo>((IEnumerable <SlideAdInfo>) this._iSlideAdsService.GetSlidAds(0L, SlideAdInfo.SlideAdType.WeixinHome));
            ISlideAdsService slideImageService = this._iSlideAdsService;

            return((ActionResult)this.View((object)Enumerable.Select <SlideAdInfo, SlideAdModel>((IEnumerable <SlideAdInfo>)slideAdInfoArray, (Func <SlideAdInfo, SlideAdModel>)(item =>
            {
                slideImageService.GetSlidAd(0L, item.Id);
                return new SlideAdModel()
                {
                    ID = item.Id,
                    imgUrl = item.ImageUrl,
                    DisplaySequence = item.DisplaySequence,
                    Url = item.Url,
                    Description = item.Description
                };
            }))));
        }
예제 #9
0
        public ActionResult SlideImageSettings()
        {
            SlideAdInfo[]              array           = ServiceHelper.Create <ISlideAdsService>().GetSlidAds(0, SlideAdInfo.SlideAdType.WeixinHome).ToArray();
            ISlideAdsService           slideAdsService = ServiceHelper.Create <ISlideAdsService>();
            IEnumerable <SlideAdModel> slideAdModels   = array.Select <SlideAdInfo, SlideAdModel>((SlideAdInfo item) => {
                slideAdsService.GetSlidAd(0, item.Id);
                return(new SlideAdModel()
                {
                    ID = item.Id,
                    imgUrl = item.ImageUrl,
                    DisplaySequence = item.DisplaySequence,
                    Url = item.Url,
                    Description = item.Description
                });
            });

            return(View(slideAdModels));
        }
예제 #10
0
        public ActionResult SaveSlideImage(long id = 0)
        {
            Entities.SlideAdInfo slideImageIfo;
            if (id > 0)
            {
                slideImageIfo = _iSlideAdsService.GetSlidAd(0, id);
            }
            else
            {
                slideImageIfo = new Entities.SlideAdInfo();
            }
            SlideAdModel model = new SlideAdModel()
            {
                Description = slideImageIfo.Description,
                imgUrl      = Core.HimallIO.GetImagePath(slideImageIfo.ImageUrl),
                Url         = slideImageIfo.Url,
                ID          = id
            };

            return(View(model));
        }
예제 #11
0
        /// <summary>
        /// 滚动图片
        /// </summary>
        /// <returns></returns>
        public JsonResult GetSlideImages()
        {
            SlideAdInfo[]    slideAdInfoArray  = Enumerable.ToArray <SlideAdInfo>((IEnumerable <SlideAdInfo>) this._iSlideAdsService.GetSlidAds(0L, SlideAdInfo.SlideAdType.WeixinHome));
            ISlideAdsService slideImageService = this._iSlideAdsService;

            return(this.Json((object)new
            {
                rows = Enumerable.Select((IEnumerable <SlideAdInfo>)slideAdInfoArray, item =>
                {
                    slideImageService.GetSlidAd(0L, item.Id);
                    var fAnonymousTypeb = new
                    {
                        id = item.Id,
                        imgUrl = HimallIO.GetImagePath(item.ImageUrl, (string)null),
                        displaySequence = item.DisplaySequence,
                        url = item.Url,
                        description = item.Description
                    };
                    return fAnonymousTypeb;
                }),
                total = 100
            }, JsonRequestBehavior.AllowGet));
        }
예제 #12
0
 /// <summary>
 /// 获取一个自动轮播广告图片
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public static SlideAdInfo GetSlidAd(long shopId, long id)
 {
     return(_iSlideAdsService.GetSlidAd(shopId, id));
 }