예제 #1
0
        public ActionResult Index()
        {
            //轮播图
            var slideImageSettings = _iSlideAdsService.GetSlidAds(0, SlideAdInfo.SlideAdType.DistributionHome).ToList();

            ViewBag.slideImage = slideImageSettings;

            CheckPromoter();
            //首页推荐商品
            var models = DistributionApplication.GetDistributionProducts(CurrentUser.Id);

            foreach (var product in models)
            {
                product.Image = HimallIO.GetRomoteProductSizeImage(product.Image, 1, (int)Himall.CommonModel.ImageSize.Size_100);
            }
            #region 二维码
            var    curhttp = System.Web.HttpContext.Current;
            string url     = curhttp.Request.Url.Scheme + "://" + curhttp.Request.Url.Authority;;
            url = url + Url.Action("Index", "DistributionMarket");

            ViewBag.ShopQCodeUrl = url;

            var    map      = Core.Helper.QRCodeHelper.Create(url);
            string fileName = "/temp/" + curUserId + DateTime.Now.ToString("yyMMddHHmmssffffff") + ".jpg";
            map.Save(Server.MapPath(fileName));
            map.Dispose();

            ViewBag.ShopQCode      = fileName;
            ViewBag.WeiXinDisIndex = false;
            if (!string.IsNullOrWhiteSpace(this._siteSetting.WeixinAppId) && !string.IsNullOrWhiteSpace(this._siteSetting.WeixinAppSecret) && (PlatformType == PlatformType.WeiXin))
            {
                ViewBag.WeiXinDisIndex = true;
            }
            #endregion
            return(View(models));
        }
        public JsonResult GetDistributionProducts(int page, int rows, string keyWords, long?categoryId = null)
        {
            var allProducts = DistributionApplication.GetDistributionProducts(page, rows, keyWords, categoryId);

            return(Json(new { rows = allProducts.Models, total = allProducts.Total }));
        }