public ActionResult EditFS(string fsmodel) { try { FlashSaleModel model = (FlashSaleModel)JsonConvert.DeserializeObject(fsmodel, typeof(FlashSaleModel)); if (Convert.ToDateTime(model.BeginDate) > Convert.ToDateTime(model.EndDate)) { return(Json(new Result { msg = "开始时间不能大于结束时间!", success = false })); } model.ShopId = CurrentSellerManager.ShopId; if (SiteSettingApplication.SiteSettings.LimitTimeBuyNeedAuditing) { model.Status = FlashSaleInfo.FlashSaleStatus.WaitForAuditing; } _iLimitTimeBuyService.UpdateFlashSale(model); ProductManagerApplication.SaveCaculateMinPrice(model.ProductId, CurrentShop.Id); //delete-pengjiangxiong //foreach (var d in model.Details) //{ // LimitOrderHelper.ModifyLimitStock(d.SkuId, d.TotalCount, DateTime.Parse(model.EndDate)); //} return(Json(new Result { msg = "修改活动成功!", success = true })); } catch (Exception ex) { return(Json(new Result { msg = ex.Message, success = false })); } }
public JsonResult EditActive(FightGroupActiveModel model) { var result = new Result { success = false, msg = "未知错误", status = -1 }; FightGroupActiveModel data = FightGroupApplication.GetActive(model.Id); if (data == null) { throw new MallException("错误的活动编号"); } if (model.EndTime < DateTime.Now) { throw new MallException("错误的结束时间"); } if (model.EndTime < model.StartTime) { throw new MallException("错误的结束时间"); } var market = MarketApplication.GetMarketService(CurrentSellerManager.ShopId, MarketType.FightGroup); if (market != null) { var endtime = MarketApplication.GetServiceEndTime(market.Id); var newEnd = DateTime.Parse(endtime.ToString("yyyy-MM-dd") + " 23:59:59"); if (newEnd < model.EndTime.Date) { throw new MallException(string.Format("活动结束时间不得超过服务到期时间,<br/>您的服务到期时间为{0}", newEnd.ToString("yyyy-MM-dd HH:mm:ss"))); } } else { throw new MallException("您没有订购此服务"); } if (ModelState.IsValid) { TryUpdateModelAsync(data); model = data; //数据有效性验证 model.CheckValidation(); data.IconUrl = SaveActiveIcon(data.IconUrl); FightGroupApplication.UpdateActive(data); ProductManagerApplication.SaveCaculateMinPrice(model.ProductId, CurrentShop.Id); result = new Result { success = true, msg = "操作成功", status = 1 }; } else { result = new Result { success = false, msg = "数据异常,请检查数据有效性", status = -1 }; } return(Json(result)); }
public JsonResult EndActive(long id) { Result result = new Result(); var data = FightGroupApplication.GetActive(id, false, false); data.EndTime = DateTime.Now.AddMinutes(-1); FightGroupApplication.UpdateActive(data); ProductManagerApplication.SaveCaculateMinPrice(data.ProductId, CurrentShop.Id); result.success = true; result.msg = "操作成功"; return(Json(result)); }
public JsonResult EndActive(long id) { Result result = new Result(); _iLimitTimeBuyService.EndActive(id); var info = _iLimitTimeBuyService.GetFlashSaleInfo(id); ProductManagerApplication.SaveCaculateMinPrice(info.ProductId, info.ShopId); result.success = true; result.msg = "操作成功"; return(Json(result)); }
/// <summary> /// 取消活动 /// </summary> /// <param name="id"></param> /// <returns></returns> public JsonResult CancelActive(long id, string mremark) { Result result = new Result { success = false, msg = "操作失败", status = -1 }; mremark = ClearHtmlString(mremark); if (string.IsNullOrWhiteSpace(mremark)) { result = new Result { success = false, msg = "请填写下架理由", status = -1 }; return(Json(result)); } FightGroupApplication.CancelActive(id, mremark, CurrentManager.Id); var info = FightGroupApplication.GetFightGroupActiveInfo(id); ProductManagerApplication.SaveCaculateMinPrice(info.ProductId, info.ShopId); result = new Result { success = true, msg = "操作成功", status = 1 }; return(Json(result)); }
public JsonResult CancelItem(long id) { Result result = new Result(); try { _iLimitTimeBuyService.Cancel(id); var info = _iLimitTimeBuyService.GetFlashSaleInfo(id); ProductManagerApplication.SaveCaculateMinPrice(info.ProductId, info.ShopId); result.success = true; result.msg = "取消成功!"; } catch (MallException ex) { result.msg = ex.Message; } catch (Exception ex) { Log.Error("取消出错", ex); result.msg = "取消出错!"; } return(Json(result)); }
public JsonResult AuditItem(long id) { Result result = new Result(); try { _iLimitTimeBuyService.Pass(id); Cache.Remove(CacheKeyCollection.CACHE_LIMITPRODUCTS); var info = _iLimitTimeBuyService.GetFlashSaleInfo(id); ProductManagerApplication.SaveCaculateMinPrice(info.ProductId, info.ShopId); result.success = true; result.msg = "审核成功!"; } catch (MallException ex) { result.msg = ex.Message; } catch (Exception ex) { Log.Error("审核出错", ex); result.msg = "审核出错!"; } return(Json(result)); }
public JsonResult AddActive(FightGroupActiveModel model) { var result = new Result { success = false, msg = "未知错误", status = -1 }; FightGroupActiveModel data = new FightGroupActiveModel(); if (model.EndTime.Date < DateTime.Now.Date) { throw new MallException("错误的结束时间"); } if (model.EndTime.Date < model.StartTime.Date) { throw new MallException("错误的结束时间"); } var market = MarketApplication.GetMarketService(CurrentSellerManager.ShopId, MarketType.FightGroup); if (market != null) { var endtime = MarketApplication.GetServiceEndTime(market.Id); var newEnd = DateTime.Parse(endtime.ToString("yyyy-MM-dd") + " 23:59:59"); if (newEnd < model.EndTime.Date) { throw new MallException(string.Format("活动结束时间不得超过服务到期时间,<br/>您的服务到期时间为{0}", newEnd.ToString("yyyy-MM-dd HH:mm:ss"))); } } else { throw new MallException("您没有订购此服务"); } //数据有效性验证 model.CheckValidation(); if (!FightGroupApplication.ProductCanJoinActive(model.ProductId)) { throw new MallException("该商品已参与拼团或其他营销活动,请重新选择"); } var skudata = FightGroupApplication.GetNewActiveItems(model.ProductId).skulist; foreach (var item in model.ActiveItems) { var cursku = skudata.FirstOrDefault(d => d.SkuId == item.SkuId); if (cursku != null) { if (item.ActiveStock > cursku.ProductStock) { throw new MallException(item.SkuName + "错误的活动库存"); } } else { model.ActiveItems.Remove(item); } } if (ModelState.IsValid) { TryUpdateModelAsync(data); data.ShopId = CurShopId; data.IconUrl = SaveActiveIcon(data.IconUrl); model = data; FightGroupApplication.AddActive(data); ProductManagerApplication.SaveCaculateMinPrice(model.ProductId, CurrentShop.Id); result = new Result { success = true, msg = "操作成功", status = 1 }; } else { result = new Result { success = false, msg = "数据异常,请检查数据有效性", status = -1 }; } return(Json(result)); }