Exemple #1
0
        public Task GetViewSetting([FromForm] int viewId)
        {
            //#1 获取视图对象
            ViewSetting setting = ViewAgent.Instance().GetViewSetting(viewId);
            IViewBase   view    = ViewUtils.CreateInstance(setting.Code, string.Empty);

            return(this.GetResult(view.ToJsonString()));
        }
Exemple #2
0
        public Task GetSiteConfig([FromForm] int id)
        {
            ViewSiteConfig config  = ViewAgent.Instance().GetSiteViewConfig(id);
            ViewSetting    setting = ViewAgent.Instance().GetViewSetting(config.ViewID);
            IViewBase      view    = ViewUtils.CreateInstance(setting.Code, config.Setting);

            return(this.GetResult(view.ToSettingObject()));
        }
Exemple #3
0
        /// <summary>
        /// 保存商户对于视图的配置
        /// </summary>
        /// <param name="configId"></param>
        /// <param name="setting"></param>
        /// <returns></returns>
        public bool SaveSiteViewConfig(int configId, string setting)
        {
            ViewSiteConfig config = this.GetSiteViewConfig(configId);

            if (config == null)
            {
                return(this.FaildMessage("配置项目错误"));
            }
            // 验证setting内容是否正确
            ViewSetting view = this.GetViewSetting(config.ViewID);

            try
            {
                ViewUtils.CreateInstance(view.Code, setting);
            }
            catch (Exception ex)
            {
                return(this.FaildMessage(ex.Message));
            }
            config.Setting = setting;
            this.WriteDB.Update <ViewSiteConfig, string>(t => t.Setting, setting, t => t.ID == configId);
            ViewCaching.Instance().SaveSiteConfig(config);
            return(this.AccountInfo.Log(LogType.Site, $"修改商户{config.SiteID}视图配置参数,ID={configId},View={view.Code}"));
        }