public JsonResult AddMemberPageModule(MemberPageModuleModel model)
        {
            bool flag = false;
            var  memberPageManager = new MemberPageManager();
            var  moduleManager     = new MemberPageModuleManager();

            if (model.PKID == 0)//新建
            {
                var memberPageInfo = memberPageManager.GetMemberPageByPageCode(model.PageCode);
                if (memberPageInfo != null)
                {
                    model.MemberPageID = memberPageInfo.PKID;
                }
                model.Creator = User.Identity.Name;
                flag          = moduleManager.AddMemberPageModule(model);
                #region 日志记录
                using (var client = new ConfigLogClient())
                {
                    var response = client.InsertDefaultLogQueue("CommonConfigLog", JsonConvert.SerializeObject(new
                    {
                        ObjectId    = model.PKID,
                        ObjectType  = "MemberPageModule",
                        BeforeValue = "",
                        AfterValue  = JsonConvert.SerializeObject(model),
                        Remark      = "创建",
                        Creator     = User.Identity.Name,
                    }));
                }
                #endregion
            }
            else//编辑
            {
                var moduleInfo = moduleManager.GetMemberPageModuleInfo(model.PKID);
                flag = moduleManager.UpdateMemberPageModule(model);
                #region 日志记录
                using (var client = new ConfigLogClient())
                {
                    var response = client.InsertDefaultLogQueue("CommonConfigLog", JsonConvert.SerializeObject(new
                    {
                        ObjectId    = model.PKID,
                        ObjectType  = "MemberPageModule",
                        BeforeValue = JsonConvert.SerializeObject(moduleInfo),
                        AfterValue  = JsonConvert.SerializeObject(model),
                        Remark      = "编辑",
                        Creator     = User.Identity.Name,
                    }));
                }
                #endregion
            }
            //等待1秒,写库同步到读库
            Thread.Sleep(1000);
            moduleManager.RefreshMemberPageCache();
            return(Json(flag));
        }
        public JsonResult AddMemberPageModuleContent(MemberPageModuleContentModel model)
        {
            #region 数据验证
            if (!string.IsNullOrEmpty(model.StartVersion))
            {
                Version startVersion;
                if (!Version.TryParse(model.StartVersion, out startVersion))
                {
                    return(Json(new { status = false, msg = "APP开始版本的类型有误" }, JsonRequestBehavior.AllowGet));
                }
            }
            if (!string.IsNullOrEmpty(model.EndVersion))
            {
                Version endVersion;
                if (!Version.TryParse(model.EndVersion, out endVersion))
                {
                    return(Json(new { status = false, msg = "APP结束版本的类型有误" }, JsonRequestBehavior.AllowGet));
                }
            }
            if (model.ChannelList != null)
            {
                foreach (var item in model.ChannelList)
                {
                    if (string.IsNullOrWhiteSpace(item.Link))
                    {
                        return(Json(new { status = false, msg = $"请输入{item.Channel}渠道的跳转链接" }, JsonRequestBehavior.AllowGet));
                    }
                }
            }
            #endregion
            bool flag = false;
            var  memberPageManager = new MemberPageManager();
            var  moduleManager     = new MemberPageModuleManager();
            var  contentManager    = new MemberPageModuleContentManager();
            var  channelManager    = new MemberPageChannelManager();

            if (model.ImageUrl == "static/default.jpg")
            {
                model.ImageUrl = null;
            }

            if (model.PKID == 0)//新建
            {
                var memberPageInfo = memberPageManager.GetMemberPageByPageCode(model.PageCode);
                if (memberPageInfo != null)
                {
                    model.MemberPageID = memberPageInfo.PKID;
                }
                model.Creator = User.Identity.Name;
                flag          = contentManager.AddMemberPageModuleContent(model);
                #region 日志记录
                using (var client = new ConfigLogClient())
                {
                    var response = client.InsertDefaultLogQueue("CommonConfigLog", JsonConvert.SerializeObject(new
                    {
                        ObjectId    = model.PKID,
                        ObjectType  = "MemberPageModuleContent",
                        BeforeValue = "",
                        AfterValue  = JsonConvert.SerializeObject(model),
                        Remark      = "创建",
                        Creator     = User.Identity.Name,
                    }));
                }
                #endregion
            }
            else//编辑
            {
                var contentInfo = contentManager.GetMemberPageModuleContentInfo(model.PKID);
                flag = contentManager.UpdateMemberPageModuleContent(model);
                channelManager.DeleteMemberPageChannel(model.PKID);
                #region 日志记录
                using (var client = new ConfigLogClient())
                {
                    var response = client.InsertDefaultLogQueue("CommonConfigLog", JsonConvert.SerializeObject(new
                    {
                        ObjectId    = model.PKID,
                        ObjectType  = "MemberPageModuleContent",
                        BeforeValue = JsonConvert.SerializeObject(contentInfo),
                        AfterValue  = JsonConvert.SerializeObject(model),
                        Remark      = "编辑",
                        Creator     = User.Identity.Name,
                    }));
                }
                #endregion
            }
            //重新保存渠道信息
            if (model.ChannelList != null)
            {
                foreach (var item in model.ChannelList)
                {
                    if (item.MemberPageModuleContentID == 0)
                    {
                        item.MemberPageModuleContentID = model.PKID;
                    }
                    channelManager.AddMemberPageChannel(item);
                }
            }

            //等待1秒,写库同步到读库
            Thread.Sleep(1000);
            moduleManager.RefreshMemberPageCache();

            return(Json(new { status = flag, msg = "" }, JsonRequestBehavior.AllowGet));
        }