public ActionResult Home(string catename = "") { List <SelectListItem> CateSelItem = new List <SelectListItem>(); var cateArray = _iLimitTimeBuyService.GetServiceCategories(); foreach (var cate in cateArray) { CateSelItem.Add(new SelectListItem { Selected = false, Text = cate, Value = cate }); } if (!string.IsNullOrWhiteSpace(catename)) { var _tmp = CateSelItem.FirstOrDefault(c => c.Text.Equals(catename)); if (_tmp != null) { _tmp.Selected = true; } } var flashSaleConfig = _iLimitTimeBuyService.GetConfig(); ViewBag.Preheat = flashSaleConfig.Preheat; ViewBag.Cate = CateSelItem; #region 初始化查询Model FlashSaleQuery query = new FlashSaleQuery() { CategoryName = catename, OrderKey = 5, /* 排序项(1:默认,2:销量,3:价格,4 : 结束时间,5:状态 开始排前面) */ IsPreheat = true, PageNo = 1, PageSize = 14, AuditStatus = FlashSaleInfo.FlashSaleStatus.Ongoing, CheckProductStatus = true }; #endregion var model = _iLimitTimeBuyService.GetAll(query); ViewBag.Products = ProductManagerApplication.GetProducts(model.Models.Select(p => p.ProductId)); return(View(model)); }
public ActionResult ConfigSetting() { return(View(_iLimitTimeBuyService.GetConfig())); }
/// <summary> /// 将最低价格保存在商品查询表中 /// </summary> /// <param name="productId"></param> /// <param name="shopId"></param> public static void SaveCaculateMinPrice(long productId, long shopId) { var product = Service.GetProduct(productId); if (product == null) { return; } decimal minPrice = 0; if (product.IsOpenLadder) { //比较阶梯价,取阶梯价最小价格,不用管梯度 var ladderSkus = _productLadderPriceService.GetLadderPricesByProductIds(productId); if (ladderSkus != null && ladderSkus.Count() > 0) { decimal minLadderPrice = ladderSkus.Min(p => p.Price); minPrice = minLadderPrice; } } else { //先取sku最小价格 var skus = Service.GetSKUs(productId); minPrice = skus.Min(p => p.SalePrice); } //比较拼团价格 var fightGroup = _iFightGroupService.GetActiveIdByProductIdAndShopId(productId, shopId); if (fightGroup != null && fightGroup.ActiveStatus == FightGroupActiveStatus.Ongoing) { var miniGroupPrice = fightGroup.ActiveItems.Min(p => p.ActivePrice); if (miniGroupPrice < minPrice) { minPrice = miniGroupPrice; } } //比较限时购价格 var ltmbuy = ServiceApplication.Create <ILimitTimeBuyService>().GetFlashSaleInfoByProductIdAndShopId(productId, shopId); if (ltmbuy != null) { if (ltmbuy.BeginDate <= DateTime.Now) { if (ltmbuy.MinPrice < minPrice) { minPrice = ltmbuy.MinPrice; } } else { var flashSaleConfig = _iLimitTimeBuyService.GetConfig(); TimeSpan flashSaleTime = ltmbuy.BeginDate - DateTime.Now; //开始时间还剩多久 TimeSpan preheatTime = new TimeSpan(flashSaleConfig.Preheat, 0, 0); //预热时间是多久 if (preheatTime >= flashSaleTime && !flashSaleConfig.IsNormalPurchase && ltmbuy.MinPrice < minPrice) //预热大于开始并且不能购买,写入最低价格,需求386 { minPrice = ltmbuy.MinPrice; } } } var searchInfo = _searchProductService.GetSingleSearchProductInfo(productId, shopId); if (searchInfo != null && minPrice != searchInfo.SalePrice) { _searchProductService.UpdateSearchProductPrice(productId, shopId, minPrice); } }
public ActionResult ConfigSetting() { ViewBag.LimitTimeBuyNeedAuditing = SiteSettings.LimitTimeBuyNeedAuditing; return(View(_iLimitTimeBuyService.GetConfig())); }