feat: Blazor 增加日志缓存时长配置信息

This commit is contained in:
Argo Zhang 2020-02-17 13:32:26 +08:00
parent c9bd585d57
commit ec692efaa3
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
2 changed files with 100 additions and 1 deletions

View File

@ -136,7 +136,7 @@
</div>
<div class="form-group col-6">
<label class="control-label" for="lockPeriod">时长间隔(秒)</label>
<input id="lockPeriod" type="number" class="form-control" value="@Model.LockScreenPeriod" />
<input id="lockPeriod" type="number" class="form-control" @bind-value="@Model.LockScreenPeriod" />
</div>
</div>
</div>
@ -208,6 +208,51 @@
</div>
</div>
</ConditionComponent>
<ConditionComponent AuthKey="logSettings">
<div class="card">
<div class="card-header">地址位置信息</div>
<div class="card-body">
<ConditionComponent>
<div class="alert alert-danger" role="alert">
<span>演示系统禁止更改日志缓存设置</span>
</div>
</ConditionComponent>
<div class="form-inline">
<div class="row">
<div class="form-group col-6">
<label class="control-label" for="appErrorLog">异常日志(月)</label>
<input id="appErrorLog" type="number" class="form-control" min="1" @bind-value="@Model.ErrorLogPeriod" />
</div>
<div class="form-group col-6">
<label class="control-label" for="opLog">操作日志(月)</label>
<input id="opLog" type="number" class="form-control" min="1" @bind-value="@Model.OpLog" />
</div>
<div class="form-group col-6">
<label class="control-label" for="logLog">登录日志(月)</label>
<input id="logLog" type="number" class="form-control" min="1" @bind-value="@Model.LogLog" />
</div>
<div class="form-group col-6">
<label class="control-label" for="traceLog">访问日志(月)</label>
<input id="traceLog" type="number" class="form-control" min="1" @bind-value="@Model.TraceLog" />
</div>
<div class="form-group col-6">
<label class="control-label" for="cookiePeriod">Cookie(天)</label>
<input id="cookiePeriod" type="number" class="form-control" min="1" @bind-value="@Model.CookiePeriod" />
</div>
<div class="form-group col-6">
<label class="control-label" for="ipCachePeriod">IP 缓存(分)</label>
<input id="ipCachePeriod" type="number" class="form-control" min="1" @bind-value="@Model.IPCachePeriod" />
</div>
</div>
</div>
<ConditionComponent Inverse="true">
<div class="modal-footer text-right">
<button class="btn btn-secondary" type="button" @onclick="SaveLogSettings"><i class="fa fa-save"></i><span>保存</span></button>
</div>
</ConditionComponent>
</div>
</div>
</ConditionComponent>
<div class="card">
<div class="card-header">
<span>网站缓存</span>

View File

@ -81,6 +81,13 @@ namespace Bootstrap.Admin.Pages.Views.Admin.Components
Text = ipSvrText,
Value = ipSvrValue
};
Model.ErrorLogPeriod = DictHelper.RetrieveExceptionsLogPeriod();
Model.OpLog = DictHelper.RetrieveLogsPeriod();
Model.LogLog = DictHelper.RetrieveLoginLogsPeriod();
Model.TraceLog = DictHelper.RetrieveAccessLogPeriod();
Model.CookiePeriod = DictHelper.RetrieveCookieExpiresPeriod();
Model.IPCachePeriod = DictHelper.RetrieveLocaleIPSvrCachePeriod();
}
/// <summary>
@ -192,6 +199,23 @@ namespace Bootstrap.Admin.Pages.Views.Admin.Components
ShowMessage("保存网站页脚", ret);
}
/// <summary>
/// 保存网站日志保留时长配置信息
/// </summary>
protected void SaveLogSettings()
{
var items = new BootstrapDict[]{
new BootstrapDict() { Category = "网站设置", Name="程序异常保留时长", Code = Model.ErrorLogPeriod.ToString(), Define = 0 },
new BootstrapDict() { Category = "网站设置", Name="操作日志保留时长", Code = Model.OpLog.ToString(), Define = 0 },
new BootstrapDict() { Category = "网站设置", Name="登录日志保留时长", Code = Model.LogLog.ToString(), Define = 0 },
new BootstrapDict() { Category = "网站设置", Name="访问日志保留时长", Code = Model.TraceLog.ToString(), Define = 0 },
new BootstrapDict() { Category = "网站设置", Name="Cookie保留时长", Code = Model.CookiePeriod.ToString(), Define = 0 },
new BootstrapDict() { Category = "网站设置", Name="IP请求缓存时长", Code = Model.IPCachePeriod.ToString(), Define = 0 }
};
var ret = DictHelper.SaveSettings(items);
ShowMessage("保存日志缓存设置", ret);
}
/// <summary>
/// 网站设置编辑模型实体类
/// </summary>
@ -271,6 +295,36 @@ namespace Bootstrap.Admin.Pages.Views.Admin.Components
/// 获得/设置 选中的地理位置配置信息
/// </summary>
public SelectedItem SelectedIPLocator { get; set; } = new SelectedItem();
/// <summary>
/// 程序异常日志保留时长
/// </summary>
public int ErrorLogPeriod { get; set; }
/// <summary>
/// 操作日志保留时长
/// </summary>
public int OpLog { get; set; }
/// <summary>
/// 登录日志保留时长
/// </summary>
public int LogLog { get; set; }
/// <summary>
/// 访问日志保留时长
/// </summary>
public int TraceLog { get; set; }
/// <summary>
/// Cookie保留时长
/// </summary>
public int CookiePeriod { get; set; }
/// <summary>
/// IP请求缓存时长
/// </summary>
public int IPCachePeriod { get; set; }
}
}
}