public JsonResult SaveBeautyBannerConfig(BeautyHomePageConfig model) { var result = false; string msg = string.Empty; try { var log = new BeautyOprLog { LogType = "SaveBeautyBannerConfig", IdentityID = $"{model.Id}", OldValue = null, NewValue = JsonConvert.SerializeObject(model), OperateUser = User.Identity.Name, Remarks = $"新增美容首页Banner配置", }; if (model.Id > 0) { var oldModel = BeautyHomePageConfigManager.GetBeautyHomePageConfigById(model.Id) ?? new BeautyHomePageConfig(); oldModel.Region = JsonConvert.SerializeObject(MeiRongAcitivityConfigManager.GetRegion(model.Id, 3)); log.OldValue = JsonConvert.SerializeObject(oldModel); log.Remarks = $"更新美容首页Banner配置"; result = BeautyHomePageConfigManager.UpdateBeautyHomePageBannerConfig(model); } else { int outId = 0; result = BeautyHomePageConfigManager.InsertBeautyHomePageBannerConfig(model, ref outId); log.IdentityID = outId.ToString(); } if (result) { LoggerManager.InsertLog("BeautyOprLog", log); UpdateBeautyBannerCache(model.Channel); } } catch (Exception ex) { msg = ex.Message; } return(Json(new { Result = result, Msg = msg })); }
public JsonResult GetBeautyBannerConfig() { var model = BeautyHomePageConfigManager.GetBeautyHomePageConfigById(BannerId) ?? new BeautyHomePageConfig(); model.RegionList = MeiRongAcitivityConfigManager.GetRegion(model.Id, 3); var regionresult = model.RegionList?.GroupBy(g => g.ProvinceName).Select(f => new { ProvinceName = f.Key, checkallgroup = f.ToArray().Select(s => s.CityName), }); var activitylist = MeiRongAcitivityConfigManager.GetMeiRongAcitivityConfigList(); return(Json(new { result = model, activity = activitylist, regionList = regionresult })); }
public ActionResult Edit(short type, int id = 0) { ViewBag.ProvinceList = MeiRongAcitivityConfigManager.GetRegion(0); if (id == 0) { BeautyHomePageConfig model = new BeautyHomePageConfig(); model.StartTime = DateTime.Now; model.EndTime = DateTime.Now.AddDays(30); model.Status = true; model.Channel = "ios"; model.Type = type; return(View(model)); } else { BeautyHomePageConfig model = BeautyHomePageConfigManager.GetBeautyHomePageConfigById(id); model.RegionList = MeiRongAcitivityConfigManager.GetRegionRelation(model.Id, 2); return(View(model)); } }