コード例 #1
0
ファイル: UserController.cs プロジェクト: ysking/comcms_core
 public UserController(IWebHostEnvironment env, IOptions <SystemSetting> attachsetting, IOptions <SystemSetting> setting)
 {
     attach         = Core.Config.GetSystemConfig().AttachConfigEntity;
     _env           = env;
     _attachsetting = attachsetting.Value;
     _appSettings   = setting.Value;
 }
コード例 #2
0
        public IActionResult AttachConfig(AttachConfigEntity model)
        {
            if (!string.IsNullOrWhiteSpace(model.WaterMarkImg))
            {
                string imgPath = _env.WebRootPath + model.WaterMarkImg.Replace("/", "\\");
                NewLife.Log.XTrace.WriteLine(_env.WebRootPath + "|" + Path.Combine(_env.WebRootPath, model.WaterMarkImg) + "|" + imgPath);
                if (!System.IO.File.Exists(imgPath))
                {
                    tip.Message = "水印图片不存在,请重新上传!";
                    return(Json(tip));
                }
            }
            string json = JsonConvert.SerializeObject(model);

            OtherConfig oc = OtherConfig.Find(OtherConfig._.ConfigName == "attach");

            if (oc == null)//如果不存在
            {
                oc                = new OtherConfig();
                oc.ConfigName     = "attach";
                oc.ConfigValue    = json;
                oc.LastUpdateTime = DateTime.Now;
                oc.Insert();
            }
            else
            {
                oc.ConfigValue    = json;
                oc.LastUpdateTime = DateTime.Now;
                oc.Update();
            }
            Admin.WriteLogActions("修改附件配置;");
            tip.Status  = JsonTip.SUCCESS;
            tip.Message = "修改附件配置成功";
            return(Json(tip));
        }
コード例 #3
0
        public IActionResult AttachConfig()
        {
            Config             cfg   = Config.GetSystemConfig();
            AttachConfigEntity model = cfg.AttachConfigEntity;

            Admin.WriteLogActions("查看附件配置;");
            return(View(model));
        }
コード例 #4
0
 public UploadController(IHostingEnvironment env, IOptions <SystemSetting> attachsetting)
 {
     attach         = Config.GetSystemConfig().AttachConfigEntity;
     _env           = env;
     _attachsetting = attachsetting.Value;
 }
コード例 #5
0
 public MemberController(IWebHostEnvironment env, IOptions <SystemSetting> systemSetting)
 {
     attach         = Config.GetSystemConfig().AttachConfigEntity;
     _env           = env;
     _systemSetting = systemSetting.Value;
 }