コード例 #1
0
        public JsonResult GetPopUpWindowsConfigById()
        {
            var model = BeautyHomePageConfigManager.GetBeautyPopUpWindowsConfigById(PKID) ?? new BeautyPopUpWindowsConfig()
            {
                Channel = "ios"
            };
            var categorys = BeautyHomePageConfigManager.GetBeautyCategoryByChannel(model.Channel);
            List <PromotionInfoModel> promotions = new List <PromotionInfoModel>();

            if (!string.IsNullOrEmpty(model.PromotionInfo))
            {
                promotions = JsonConvert.DeserializeObject <List <PromotionInfoModel> >(model.PromotionInfo);
            }
            List <BeautyPopUpWindowsRegionModel> regions = new List <BeautyPopUpWindowsRegionModel>();

            if (model.IsRegion && model.PKID > 0)
            {
                regions = BeautyHomePageConfigManager.GetBeautyPopUpWindowsRegionConfigs(model.PKID)?.ToList();
            }


            return(Json(new
            {
                result = model,
                CategoryList = categorys,
                PromotionList = promotions,
                RegionList = regions
            }));
        }
コード例 #2
0
        public ActionResult Edit(BeautyHomePageConfig model)
        {
            try
            {
                if (model.Id != 0)
                {
                    if (BeautyHomePageConfigManager.UpdateBeautyHomePageConfig(model))
                    {
                        CleanCahce(model.Channel, model.Type);
                    }
                }
                else
                {
                    int outId = 0;
                    if (BeautyHomePageConfigManager.InsertBeautyHomePageConfig(model, ref outId))
                    {
                        CleanCahce(model.Channel, model.Type);
                    }
                }

                return(Json(true));
            }
            catch (Exception ex)
            {
                return(Json(false));

                throw ex;
            }
        }
コード例 #3
0
        public JsonResult GetPopUpWindowsConfigList()
        {
            int count = 0;
            var list  = BeautyHomePageConfigManager.SelectBeautyPopUpConfig(Status, KeyWords, CurrentPage, PageSize, out count)?.ToList();
            Dictionary <string, List <BeautyCategorySimple> > dic = new Dictionary <string, List <BeautyCategorySimple> >();

            list.Select(s => s.Channel).Distinct().ForEach(f =>
            {
                if (!dic.ContainsKey(f))
                {
                    var categorys = BeautyHomePageConfigManager.GetBeautyCategoryByChannel(f)?.ToList();
                    if (categorys != null && categorys.Any())
                    {
                        dic.Add(f, categorys);
                    }
                }
            });
            list.ForEach(f =>
            {
                if (!string.IsNullOrEmpty(f.Channel) && f.CategoryId > 0 && dic.ContainsKey(f.Channel))
                {
                    f.CategoryName = dic[f.Channel].FirstOrDefault(e => e.Id == f.CategoryId).Name;
                }
            });



            return(Json(new { result = list, total = count }, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
        public JsonResult SelectBeautyBannerConfigs()
        {
            int totalCount    = 0;
            var bannerConfigs = BeautyHomePageConfigManager.SelectBeautyBannerConfig(Status, KeyWords, CurrentPage, PageSize, out totalCount);

            return(Json(new { result = bannerConfigs, total = totalCount, }, JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
        public async Task <ActionResult> Edit(BeautyHomePageConfig model)
        {
            try
            {
                if (model.Id != 0)
                {
                    if (BeautyHomePageConfigManager.UpdateBeautyHomePageConfig(model))
                    {
                        CleanCahce(model.Channel, model.Type);
                    }
                    var beautyServiceProxy = new BeautyServiceProxy();
                    await beautyServiceProxy.RefreshModuleCacheAsync(model.Id);

                    await beautyServiceProxy.RemoveCacheKeyAsync($"BeautyCategoriesPrefixV2-{model.Id}");
                }
                else
                {
                    int outId = 0;
                    if (BeautyHomePageConfigManager.InsertBeautyHomePageConfig(model, ref outId))
                    {
                        CleanCahce(model.Channel, model.Type);
                    }
                }

                return(Json(true));
            }
            catch (Exception ex)
            {
                return(Json(false));

                throw ex;
            }
        }
コード例 #6
0
        public JsonResult RefreshBeautyCache()
        {
            var manager  = new BeautyHomePageConfigManager();
            var channels = manager.GetBeautyChannel();

            if (channels.Any())
            {
                var results = channels.Select(x => RefreshBeautyConfigCache(x)).ToList();
                return(Json(new { Status = results.All(x => x) }));
            }
            return(Json(new { Status = false }));
        }
コード例 #7
0
        public ActionResult List(BeautyHomePageConfig model, int pageIndex = 1, int pageSize = 15)
        {
            int    count  = 0;
            string strSql = string.Empty;

            var lists = BeautyHomePageConfigManager.GetBeautyHomePageConfigList(model, pageSize, pageIndex, out count);

            var list  = new OutData <List <BeautyHomePageConfig>, int>(lists, count);
            var pager = new PagerModel(pageIndex, pageSize)
            {
                TotalItem = count
            };

            return(View(new ListModel <BeautyHomePageConfig>(list.ReturnValue, pager)));
        }
コード例 #8
0
        public ActionResult EditShopConfig(BeautyHomePageConfig model)
        {
            var result = false;

            model.StartTime = DateTime.Now;
            model.EndTime   = new DateTime(2999, 12, 31);
            model.Type      = (short)(model.Type + 1000);
            if (model.Id != 0)
            {
                result = BeautyHomePageConfigManager.UpdateBeautyHomePageConfig(model);
            }
            else
            {
                int outId = 0;
                result = BeautyHomePageConfigManager.InsertBeautyHomePageConfig(model, ref outId);
            }
            return(Json(new { Status = result }));
        }
コード例 #9
0
        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 }));
        }
コード例 #10
0
        public JsonResult SavePopUpWindowsConfig(BeautyPopUpWindowsConfig model)
        {
            string msg    = string.Empty;
            bool   result = false;

            try
            {
                result = BeautyHomePageConfigManager.SaveBeautyPopUpWindowsConfig(model, User.Identity.Name);
                if (result)
                {
                    RefreshBeautyPopUpCache();
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }
            return(Json(new { Result = result, Msg = msg }));
        }
コード例 #11
0
        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
            }));
        }
コード例 #12
0
        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));
            }
        }
コード例 #13
0
        public JsonResult GetBeautyCategorysByChannel(string channel)
        {
            IEnumerable <BeautyCategorySimple> categorys = null;
            bool   success = true;
            string msg     = "";

            try
            {
                categorys = BeautyHomePageConfigManager.GetBeautyCategoryByChannel(channel);
            }
            catch (Exception ex)
            {
                success = false;
                msg     = ex.Message;
            }
            return(Json(new
            {
                Success = success,
                CategoryList = categorys,
                Msg = msg
            }));
        }
コード例 #14
0
        public JsonResult DeletePopUpWindowsConfigById()
        {
            string msg    = string.Empty;
            bool   result = false;

            try
            {
                result = BeautyHomePageConfigManager.DeleteBeautyPopUpWindowsConfig(PKID);
                if (result)
                {
                    RefreshBeautyPopUpCache();
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }

            return(Json(new
            {
                Result = result,
                Msg = msg
            }));
        }
コード例 #15
0
        public ActionResult GetShopConfigs()
        {
            var result = BeautyHomePageConfigManager.GetShopMapConfigs();

            return(Json(new { Status = result != null, Data = result }, JsonRequestBehavior.AllowGet));
        }
コード例 #16
0
 public JsonResult Delete(int id)
 {
     return(Json(BeautyHomePageConfigManager.DeleteBeautyHomePageConfig(id)));
 }