改进操作日志

This commit is contained in:
GoEdgeLab
2020-11-20 15:32:42 +08:00
parent 60ba3e0a05
commit fc459a50b9
142 changed files with 230 additions and 100 deletions

2
go.mod
View File

@@ -8,7 +8,7 @@ require (
github.com/TeaOSLab/EdgeCommon v0.0.0-00010101000000-000000000000 github.com/TeaOSLab/EdgeCommon v0.0.0-00010101000000-000000000000
github.com/go-sql-driver/mysql v1.5.0 github.com/go-sql-driver/mysql v1.5.0
github.com/go-yaml/yaml v2.1.0+incompatible github.com/go-yaml/yaml v2.1.0+incompatible
github.com/iwind/TeaGo v0.0.0-20201110043415-859f4b3b98f3 github.com/iwind/TeaGo v0.0.0-20201120063500-ee2d7090f4bc
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c // indirect golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c // indirect
google.golang.org/grpc v1.32.0 google.golang.org/grpc v1.32.0
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776

2
go.sum
View File

@@ -52,6 +52,8 @@ github.com/iwind/TeaGo v0.0.0-20201110022333-4505cfeba483 h1:iQlMhGYBNrvbyp90f4W
github.com/iwind/TeaGo v0.0.0-20201110022333-4505cfeba483/go.mod h1:KU4mS7QNiZ7QWEuDBk1zw0/Q2LrAPZv3tycEFBsuUwc= github.com/iwind/TeaGo v0.0.0-20201110022333-4505cfeba483/go.mod h1:KU4mS7QNiZ7QWEuDBk1zw0/Q2LrAPZv3tycEFBsuUwc=
github.com/iwind/TeaGo v0.0.0-20201110043415-859f4b3b98f3 h1:fJ32s0nZmhH780KYG9oWi11chljyaZ4JLRTvKV8nzb0= github.com/iwind/TeaGo v0.0.0-20201110043415-859f4b3b98f3 h1:fJ32s0nZmhH780KYG9oWi11chljyaZ4JLRTvKV8nzb0=
github.com/iwind/TeaGo v0.0.0-20201110043415-859f4b3b98f3/go.mod h1:KU4mS7QNiZ7QWEuDBk1zw0/Q2LrAPZv3tycEFBsuUwc= github.com/iwind/TeaGo v0.0.0-20201110043415-859f4b3b98f3/go.mod h1:KU4mS7QNiZ7QWEuDBk1zw0/Q2LrAPZv3tycEFBsuUwc=
github.com/iwind/TeaGo v0.0.0-20201120063500-ee2d7090f4bc h1:AOKJWsgCX5e7xnW2f7evcrgj6vzvvHIoDmA+xxL3BMI=
github.com/iwind/TeaGo v0.0.0-20201120063500-ee2d7090f4bc/go.mod h1:KU4mS7QNiZ7QWEuDBk1zw0/Q2LrAPZv3tycEFBsuUwc=
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=

View File

@@ -78,12 +78,25 @@ func (this *ParentAction) AdminId() int64 {
} }
func (this *ParentAction) CreateLog(level string, description string, args ...interface{}) { func (this *ParentAction) CreateLog(level string, description string, args ...interface{}) {
err := models.SharedLogDAO.CreateAdminLog(this.AdminContext(), level, this.Request.URL.Path, fmt.Sprintf(description, args...), this.RequestRemoteIP()) desc := fmt.Sprintf(description, args...)
if level == oplogs.LevelInfo {
if this.Code != 200 {
level = oplogs.LevelWarn
if len(this.Message) > 0 {
desc += " 失败:" + this.Message
}
}
}
err := models.SharedLogDAO.CreateAdminLog(this.AdminContext(), level, this.Request.URL.Path, desc, this.RequestRemoteIP())
if err != nil { if err != nil {
utils.PrintError(err) utils.PrintError(err)
} }
} }
func (this *ParentAction) CreateLogInfo(description string, args ...interface{}) {
this.CreateLog(oplogs.LevelInfo, description, args...)
}
// 获取RPC // 获取RPC
func (this *ParentAction) RPC() *rpc.RPCClient { func (this *ParentAction) RPC() *rpc.RPCClient {
if this.rpcClient != nil { if this.rpcClient != nil {

View File

@@ -22,7 +22,7 @@ func (this *DeleteAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "删除API节点 %d", params.NodeId) defer this.CreateLog(oplogs.LevelInfo, "删除API节点 %d", params.NodeId)
this.Success() this.Success()
} }

View File

@@ -137,7 +137,7 @@ func (this *CreatePopupAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "创建API节点 %d", createResp.NodeId) defer this.CreateLog(oplogs.LevelInfo, "创建API节点 %d", createResp.NodeId)
this.Success() this.Success()
} }

View File

@@ -234,7 +234,7 @@ func (this *UpdateAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "修改API节点 %d", params.NodeId) defer this.CreateLog(oplogs.LevelInfo, "修改API节点 %d", params.NodeId)
this.Success() this.Success()
} }

View File

@@ -99,7 +99,7 @@ func (this *CreateBatchAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "批量创建节点") defer this.CreateLog(oplogs.LevelInfo, "批量创建节点")
this.Success() this.Success()
} }

View File

@@ -159,7 +159,7 @@ func (this *CreateNodeAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "创建节点 %d", nodeId) defer this.CreateLog(oplogs.LevelInfo, "创建节点 %d", nodeId)
this.Success() this.Success()
} }

View File

@@ -40,7 +40,7 @@ func (this *DeleteAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "删除集群 %d", params.ClusterId) defer this.CreateLog(oplogs.LevelInfo, "删除集群 %d", params.ClusterId)
this.Success() this.Success()
} }

View File

@@ -48,7 +48,7 @@ func (this *CreatePopupAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "创建集群分组", createResp.GroupId) defer this.CreateLog(oplogs.LevelInfo, "创建集群分组", createResp.GroupId)
this.Success() this.Success()
} }

View File

@@ -31,7 +31,7 @@ func (this *DeleteAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "删除集群分组 %d", params.GroupId) defer this.CreateLog(oplogs.LevelInfo, "删除集群分组 %d", params.GroupId)
this.Success() this.Success()
} }

View File

@@ -20,7 +20,7 @@ func (this *SortAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "修改集群分组排序") defer this.CreateLog(oplogs.LevelInfo, "修改集群分组排序")
this.Success() this.Success()
} }

View File

@@ -57,7 +57,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "修改集群分组 %d", params.GroupId) defer this.CreateLog(oplogs.LevelInfo, "修改集群分组 %d", params.GroupId)
this.Success() this.Success()
} }

View File

@@ -80,7 +80,7 @@ func (this *InstallRemoteAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "远程安装节点 %d", params.NodeId) defer this.CreateLog(oplogs.LevelInfo, "远程安装节点 %d", params.NodeId)
this.Success() this.Success()
} }

View File

@@ -112,7 +112,7 @@ func (this *InstallAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "安装节点 %d", params.NodeId) defer this.CreateLog(oplogs.LevelInfo, "安装节点 %d", params.NodeId)
this.Success() this.Success()
} }

View File

@@ -20,7 +20,7 @@ func (this *StartAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "远程启动节点 %d", params.NodeId) defer this.CreateLog(oplogs.LevelInfo, "远程启动节点 %d", params.NodeId)
if resp.IsOk { if resp.IsOk {
this.Success() this.Success()

View File

@@ -20,7 +20,7 @@ func (this *StopAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "远程停止节点 %d", params.NodeId) defer this.CreateLog(oplogs.LevelInfo, "远程停止节点 %d", params.NodeId)
if resp.IsOk { if resp.IsOk {
this.Success() this.Success()

View File

@@ -190,7 +190,7 @@ func (this *UpdateAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "修改节点 %d", params.NodeId) defer this.CreateLog(oplogs.LevelInfo, "修改节点 %d", params.NodeId)
if params.NodeId <= 0 { if params.NodeId <= 0 {
this.Fail("要操作的节点不存在") this.Fail("要操作的节点不存在")

View File

@@ -15,7 +15,7 @@ func (this *UpdateInstallStatusAction) RunPost(params struct {
IsInstalled bool IsInstalled bool
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "修改节点安装状态 %d", params.NodeId) defer this.CreateLog(oplogs.LevelInfo, "修改节点安装状态 %d", params.NodeId)
_, err := this.RPC().NodeRPC().UpdateNodeIsInstalled(this.AdminContext(), &pb.UpdateNodeIsInstalledRequest{ _, err := this.RPC().NodeRPC().UpdateNodeIsInstalled(this.AdminContext(), &pb.UpdateNodeIsInstalledRequest{
NodeId: params.NodeId, NodeId: params.NodeId,

View File

@@ -61,7 +61,7 @@ func (this *IndexAction) RunPost(params struct {
CSRF *actionutils.CSRF CSRF *actionutils.CSRF
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "修改集群 %d DNS设置", params.ClusterId) defer this.CreateLog(oplogs.LevelInfo, "修改集群 %d DNS设置", params.ClusterId)
// 检查DNS名称 // 检查DNS名称
if len(params.DnsName) > 0 { if len(params.DnsName) > 0 {

View File

@@ -46,7 +46,7 @@ func (this *HealthAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "修改集群健康检查设置 %d", params.ClusterId) defer this.CreateLog(oplogs.LevelInfo, "修改集群健康检查设置 %d", params.ClusterId)
config := &serverconfigs.HealthCheckConfig{} config := &serverconfigs.HealthCheckConfig{}
err := json.Unmarshal(params.HealthCheckJSON, config) err := json.Unmarshal(params.HealthCheckJSON, config)

View File

@@ -26,7 +26,7 @@ func (this *HealthRunPopupAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "执行集群健康检查设置 %d", params.ClusterId) defer this.CreateLog(oplogs.LevelInfo, "执行集群健康检查设置 %d", params.ClusterId)
resp, err := this.RPC().NodeClusterRPC().ExecuteNodeClusterHealthCheck(this.AdminContext(), &pb.ExecuteNodeClusterHealthCheckRequest{ClusterId: params.ClusterId}) resp, err := this.RPC().NodeClusterRPC().ExecuteNodeClusterHealthCheck(this.AdminContext(), &pb.ExecuteNodeClusterHealthCheckRequest{ClusterId: params.ClusterId})
if err != nil { if err != nil {

View File

@@ -72,7 +72,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "修改集群基础设置 %d", params.ClusterId) defer this.CreateLog(oplogs.LevelInfo, "修改集群基础设置 %d", params.ClusterId)
params.Must. params.Must.
Field("name", params.Name). Field("name", params.Name).

View File

@@ -117,7 +117,7 @@ func (this *UpdateNodeSSHAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "修改节点 %d 配置", params.NodeId) defer this.CreateLog(oplogs.LevelInfo, "修改节点 %d 配置", params.NodeId)
this.Success() this.Success()
} }

View File

@@ -69,7 +69,7 @@ func (this *UpgradeRemoteAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "远程升级节点 %d", params.NodeId) defer this.CreateLog(oplogs.LevelInfo, "远程升级节点 %d", params.NodeId)
this.Success() this.Success()
} }

View File

@@ -79,7 +79,7 @@ func (this *CreateAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "创建节点集群:%d", createResp.ClusterId) defer this.CreateLog(oplogs.LevelInfo, "创建节点集群:%d", createResp.ClusterId)
this.Success() this.Success()
} }

View File

@@ -64,7 +64,7 @@ func (this *CreateAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "创建SSH认证 %d", createResp.GrantId) defer this.CreateLog(oplogs.LevelInfo, "创建SSH认证 %d", createResp.GrantId)
this.Success() this.Success()
} }

View File

@@ -72,7 +72,7 @@ func (this *CreatePopupAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "创建SSH认证 %d", createResp.GrantId) defer this.CreateLog(oplogs.LevelInfo, "创建SSH认证 %d", createResp.GrantId)
this.Success() this.Success()
} }

View File

@@ -14,7 +14,7 @@ func (this *DeleteAction) RunPost(params struct {
GrantId int64 GrantId int64
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "删除SSH认证 %d", params.GrantId) defer this.CreateLog(oplogs.LevelInfo, "删除SSH认证 %d", params.GrantId)
// 检查是否有别的集群或节点正在使用 // 检查是否有别的集群或节点正在使用
countResp, err := this.RPC().NodeClusterRPC().CountAllEnabledNodeClustersWithGrantId(this.AdminContext(), &pb.CountAllEnabledNodeClustersWithGrantIdRequest{ countResp, err := this.RPC().NodeClusterRPC().CountAllEnabledNodeClustersWithGrantId(this.AdminContext(), &pb.CountAllEnabledNodeClustersWithGrantIdRequest{

View File

@@ -62,7 +62,7 @@ func (this *UpdateAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "修改SSH认证 %d", params.GrantId) defer this.CreateLog(oplogs.LevelInfo, "修改SSH认证 %d", params.GrantId)
params.Must. params.Must.
Field("name", params.Name). Field("name", params.Name).

View File

@@ -61,7 +61,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "修改SSH认证 %d", params.GrantId) defer this.CreateLog(oplogs.LevelInfo, "修改SSH认证 %d", params.GrantId)
params.Must. params.Must.
Field("name", params.Name). Field("name", params.Name).

View File

@@ -62,7 +62,7 @@ func (this *CreatePopupAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "创建数据库节点 %d", createResp.NodeId) defer this.CreateLog(oplogs.LevelInfo, "创建数据库节点 %d", createResp.NodeId)
this.Success() this.Success()
} }

View File

@@ -14,7 +14,7 @@ func (this *DeleteAction) RunPost(params struct {
NodeId int64 NodeId int64
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "删除数据库节点 %d", params.NodeId) defer this.CreateLog(oplogs.LevelInfo, "删除数据库节点 %d", params.NodeId)
_, err := this.RPC().DBNodeRPC().DeleteDBNode(this.AdminContext(), &pb.DeleteDBNodeRequest{NodeId: params.NodeId}) _, err := this.RPC().DBNodeRPC().DeleteDBNode(this.AdminContext(), &pb.DeleteDBNodeRequest{NodeId: params.NodeId})
if err != nil { if err != nil {

View File

@@ -62,7 +62,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "修改数据库节点 %d", params.NodeId) defer this.CreateLog(oplogs.LevelInfo, "修改数据库节点 %d", params.NodeId)
params.Must. params.Must.
Field("name", params.Name). Field("name", params.Name).

View File

@@ -14,7 +14,7 @@ func (this *SyncAction) RunPost(params struct {
ClusterId int64 ClusterId int64
}) { }) {
// 记录日志 // 记录日志
this.CreateLog(oplogs.LevelInfo, "同步集群 %d 的DNS设置", params.ClusterId) defer this.CreateLog(oplogs.LevelInfo, "同步集群 %d 的DNS设置", params.ClusterId)
dnsInfoResp, err := this.RPC().NodeClusterRPC().FindEnabledNodeClusterDNS(this.AdminContext(), &pb.FindEnabledNodeClusterDNSRequest{NodeClusterId: params.ClusterId}) dnsInfoResp, err := this.RPC().NodeClusterRPC().FindEnabledNodeClusterDNS(this.AdminContext(), &pb.FindEnabledNodeClusterDNSRequest{NodeClusterId: params.ClusterId})
if err != nil { if err != nil {

View File

@@ -54,7 +54,7 @@ func (this *CreatePopupAction) RunPost(params struct {
return return
} }
this.CreateLog(oplogs.LevelInfo, "添加管理域名到DNS服务商 %d", createResp.DnsDomainId) defer this.CreateLog(oplogs.LevelInfo, "添加管理域名到DNS服务商 %d", createResp.DnsDomainId)
this.Success() this.Success()
} }

View File

@@ -15,7 +15,7 @@ func (this *DeleteAction) RunPost(params struct {
DomainId int64 DomainId int64
}) { }) {
// 记录日志 // 记录日志
this.CreateLog(oplogs.LevelInfo, "从DNS服务商中删除域名 %d", params.DomainId) defer this.CreateLog(oplogs.LevelInfo, "从DNS服务商中删除域名 %d", params.DomainId)
// 检查是否正在使用 // 检查是否正在使用
countResp, err := this.RPC().NodeClusterRPC().CountAllEnabledNodeClustersWithDNSDomainId(this.AdminContext(), &pb.CountAllEnabledNodeClustersWithDNSDomainIdRequest{DnsDomainId: params.DomainId}) countResp, err := this.RPC().NodeClusterRPC().CountAllEnabledNodeClustersWithDNSDomainId(this.AdminContext(), &pb.CountAllEnabledNodeClustersWithDNSDomainIdRequest{DnsDomainId: params.DomainId})

View File

@@ -14,7 +14,7 @@ func (this *SyncAction) RunPost(params struct {
DomainId int64 DomainId int64
}) { }) {
// 记录日志 // 记录日志
this.CreateLog(oplogs.LevelInfo, "同步DNS域名数据 %d", params.DomainId) defer this.CreateLog(oplogs.LevelInfo, "同步DNS域名数据 %d", params.DomainId)
// 执行同步 // 执行同步
resp, err := this.RPC().DNSDomainRPC().SyncDNSDomainData(this.AdminContext(), &pb.SyncDNSDomainDataRequest{DnsDomainId: params.DomainId}) resp, err := this.RPC().DNSDomainRPC().SyncDNSDomainData(this.AdminContext(), &pb.SyncDNSDomainDataRequest{DnsDomainId: params.DomainId})

View File

@@ -52,7 +52,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
// TODO 检查DomainId // TODO 检查DomainId
// 记录日志 // 记录日志
this.CreateLog(oplogs.LevelInfo, "修改管理域名到DNS服务商 %d", params.DomainId) defer this.CreateLog(oplogs.LevelInfo, "修改管理域名到DNS服务商 %d", params.DomainId)
params.Must. params.Must.
Field("name", params.Name). Field("name", params.Name).

View File

@@ -74,7 +74,7 @@ func (this *UpdateNodePopupAction) RunPost(params struct {
CSRF *actionutils.CSRF CSRF *actionutils.CSRF
}) { }) {
// 操作日志 // 操作日志
this.CreateLog(oplogs.LevelInfo, "修改节点 %d 的DNS设置", params.NodeId) defer this.CreateLog(oplogs.LevelInfo, "修改节点 %d 的DNS设置", params.NodeId)
routes := []string{} routes := []string{}
err := json.Unmarshal(params.DnsRoutesJSON, &routes) err := json.Unmarshal(params.DnsRoutesJSON, &routes)

View File

@@ -103,7 +103,7 @@ func (this *CreatePopupAction) RunPost(params struct {
return return
} }
this.CreateLog(oplogs.LevelInfo, "创建DNS服务商 %d", createResp.DnsProviderId) defer this.CreateLog(oplogs.LevelInfo, "创建DNS服务商 %d", createResp.DnsProviderId)
this.Success() this.Success()
} }

View File

@@ -17,7 +17,7 @@ func (this *DeleteAction) RunPost(params struct {
// TODO 检查权限 // TODO 检查权限
// 记录日志 // 记录日志
this.CreateLog(oplogs.LevelInfo, "删除DNS服务商 %d", params.ProviderId) defer this.CreateLog(oplogs.LevelInfo, "删除DNS服务商 %d", params.ProviderId)
// 检查是否被使用 // 检查是否被使用
countClustersResp, err := this.RPC().NodeClusterRPC().CountAllEnabledNodeClustersWithDNSProviderId(this.AdminContext(), &pb.CountAllEnabledNodeClustersWithDNSProviderIdRequest{DnsProviderId: params.ProviderId}) countClustersResp, err := this.RPC().NodeClusterRPC().CountAllEnabledNodeClustersWithDNSProviderId(this.AdminContext(), &pb.CountAllEnabledNodeClustersWithDNSProviderIdRequest{DnsProviderId: params.ProviderId})

View File

@@ -87,7 +87,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
CSRF *actionutils.CSRF CSRF *actionutils.CSRF
}) { }) {
this.CreateLog(oplogs.LevelInfo, "修改DNS服务商 %d", params.ProviderId) defer this.CreateLog(oplogs.LevelInfo, "修改DNS服务商 %d", params.ProviderId)
params.Must. params.Must.
Field("name", params.Name). Field("name", params.Name).

View File

@@ -75,7 +75,7 @@ func (this *UpdateClusterPopupAction) RunPost(params struct {
CSRF *actionutils.CSRF CSRF *actionutils.CSRF
}) { }) {
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "修改集群 %d DNS设置", params.ClusterId) defer this.CreateLog(oplogs.LevelInfo, "修改集群 %d DNS设置", params.ClusterId)
params.Must. params.Must.
Field("dnsName", params.DnsName). Field("dnsName", params.DnsName).

View File

@@ -12,7 +12,7 @@ type ReadAllAction struct {
func (this *ReadAllAction) RunPost(params struct{}) { func (this *ReadAllAction) RunPost(params struct{}) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "将所有消息置为已读") defer this.CreateLog(oplogs.LevelInfo, "将所有消息置为已读")
_, err := this.RPC().MessageRPC().UpdateAllMessagesRead(this.AdminContext(), &pb.UpdateAllMessagesReadRequest{}) _, err := this.RPC().MessageRPC().UpdateAllMessagesRead(this.AdminContext(), &pb.UpdateAllMessagesReadRequest{})
if err != nil { if err != nil {

View File

@@ -14,7 +14,7 @@ func (this *ReadPageAction) RunPost(params struct {
MessageIds []int64 MessageIds []int64
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "将一组消息置为已读") defer this.CreateLog(oplogs.LevelInfo, "将一组消息置为已读")
_, err := this.RPC().MessageRPC().UpdateMessagesRead(this.AdminContext(), &pb.UpdateMessagesReadRequest{ _, err := this.RPC().MessageRPC().UpdateMessagesRead(this.AdminContext(), &pb.UpdateMessagesReadRequest{
MessageIds: params.MessageIds, MessageIds: params.MessageIds,

View File

@@ -20,7 +20,7 @@ func (this *DeleteAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "删除节点", params.NodeId) defer this.CreateLog(oplogs.LevelInfo, "删除节点", params.NodeId)
this.Success() this.Success()
} }

View File

@@ -71,7 +71,7 @@ func (this *AddOriginPopupAction) RunPost(params struct {
this.Data["origin"] = origin this.Data["origin"] = origin
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "创建源站 %d", resp.OriginId) defer this.CreateLog(oplogs.LevelInfo, "创建源站 %d", resp.OriginId)
this.Success() this.Success()
} }

View File

@@ -90,7 +90,7 @@ func (this *CleanAction) RunPost(params struct {
this.Data["results"] = results this.Data["results"] = results
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "清除缓存,缓存策略:%d", params.CachePolicyId) defer this.CreateLog(oplogs.LevelInfo, "清除缓存,缓存策略:%d", params.CachePolicyId)
this.Success() this.Success()
} }

View File

@@ -80,7 +80,7 @@ func (this *CreatePopupAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "创建缓存策略:%d", createResp.CachePolicyId) defer this.CreateLog(oplogs.LevelInfo, "创建缓存策略:%d", createResp.CachePolicyId)
this.Success() this.Success()
} }

View File

@@ -30,7 +30,7 @@ func (this *DeleteAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "删除缓存策略:%d", params.CachePolicyId) defer this.CreateLog(oplogs.LevelInfo, "删除缓存策略:%d", params.CachePolicyId)
this.Success() this.Success()
} }

View File

@@ -110,7 +110,7 @@ func (this *PreheatAction) RunPost(params struct {
this.Data["results"] = results this.Data["results"] = results
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "预热缓存,缓存策略:%d", params.CachePolicyId) defer this.CreateLog(oplogs.LevelInfo, "预热缓存,缓存策略:%d", params.CachePolicyId)
this.Success() this.Success()
} }

View File

@@ -109,7 +109,7 @@ func (this *PurgeAction) RunPost(params struct {
this.Data["results"] = results this.Data["results"] = results
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "删除缓存,缓存策略:%d", params.CachePolicyId) defer this.CreateLog(oplogs.LevelInfo, "删除缓存,缓存策略:%d", params.CachePolicyId)
this.Success() this.Success()
} }

View File

@@ -90,7 +90,7 @@ func (this *StatAction) RunPost(params struct {
this.Data["results"] = results this.Data["results"] = results
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "统计缓存,缓存策略:%d", params.CachePolicyId) defer this.CreateLog(oplogs.LevelInfo, "统计缓存,缓存策略:%d", params.CachePolicyId)
this.Success() this.Success()
} }

View File

@@ -58,7 +58,7 @@ func (this *TestReadAction) RunPost(params struct {
this.Data["results"] = results this.Data["results"] = results
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "测试读取,缓存策略:%d", params.CachePolicyId) defer this.CreateLog(oplogs.LevelInfo, "测试读取,缓存策略:%d", params.CachePolicyId)
this.Success() this.Success()
} }

View File

@@ -61,7 +61,7 @@ func (this *TestWriteAction) RunPost(params struct {
this.Data["results"] = results this.Data["results"] = results
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "测试写入,缓存策略:%d", params.CachePolicyId) defer this.CreateLog(oplogs.LevelInfo, "测试写入,缓存策略:%d", params.CachePolicyId)
this.Success() this.Success()
} }

View File

@@ -106,7 +106,7 @@ func (this *UpdateAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "修改缓存策略:%d", params.CachePolicyId) defer this.CreateLog(oplogs.LevelInfo, "修改缓存策略:%d", params.CachePolicyId)
this.Success() this.Success()
} }

View File

@@ -42,7 +42,7 @@ func (this *CreatePopupAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "创建代理服务分组 %d", createResp.GroupId) defer this.CreateLog(oplogs.LevelInfo, "创建代理服务分组 %d", createResp.GroupId)
this.Success() this.Success()
} }

View File

@@ -14,7 +14,7 @@ func (this *DeleteAction) RunPost(params struct {
GroupId int64 GroupId int64
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "删除代理服务分组 %d", params.GroupId) defer this.CreateLog(oplogs.LevelInfo, "删除代理服务分组 %d", params.GroupId)
// 检查是否正在使用 // 检查是否正在使用
countResp, err := this.RPC().ServerRPC().CountAllEnabledServersWithGroupId(this.AdminContext(), &pb.CountAllEnabledServersWithGroupIdRequest{GroupId: params.GroupId}) countResp, err := this.RPC().ServerRPC().CountAllEnabledServersWithGroupId(this.AdminContext(), &pb.CountAllEnabledServersWithGroupIdRequest{GroupId: params.GroupId})

View File

@@ -14,7 +14,7 @@ func (this *SortAction) RunPost(params struct {
GroupIds []int64 GroupIds []int64
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "修改代理分组排序") defer this.CreateLog(oplogs.LevelInfo, "修改代理分组排序")
_, err := this.RPC().ServerGroupRPC().UpdateServerGroupOrders(this.AdminContext(), &pb.UpdateServerGroupOrdersRequest{GroupIds: params.GroupIds}) _, err := this.RPC().ServerGroupRPC().UpdateServerGroupOrders(this.AdminContext(), &pb.UpdateServerGroupOrdersRequest{GroupIds: params.GroupIds})
if err != nil { if err != nil {

View File

@@ -45,7 +45,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "修改代理服务分组 %d", params.GroupId) defer this.CreateLog(oplogs.LevelInfo, "修改代理服务分组 %d", params.GroupId)
params.Must. params.Must.
Field("name", params.Name). Field("name", params.Name).

View File

@@ -56,7 +56,7 @@ func (this *IndexAction) RunPost(params struct {
DefaultDomain string DefaultDomain string
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "保存代理服务全局配置") defer this.CreateLog(oplogs.LevelInfo, "保存代理服务全局配置")
if len(params.GlobalConfigJSON) == 0 { if len(params.GlobalConfigJSON) == 0 {
this.Fail("错误的配置信息,请刷新当前页面后重试") this.Fail("错误的配置信息,请刷新当前页面后重试")

View File

@@ -14,7 +14,7 @@ func (this *DeleteAction) RunPost(params struct {
LibraryId int64 LibraryId int64
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "删除IP库 %d", params.LibraryId) defer this.CreateLog(oplogs.LevelInfo, "删除IP库 %d", params.LibraryId)
_, err := this.RPC().IPLibraryRPC().DeleteIPLibrary(this.AdminContext(), &pb.DeleteIPLibraryRequest{IpLibraryId: params.LibraryId}) _, err := this.RPC().IPLibraryRPC().DeleteIPLibrary(this.AdminContext(), &pb.DeleteIPLibraryRequest{IpLibraryId: params.LibraryId})
if err != nil { if err != nil {

View File

@@ -18,7 +18,7 @@ func (this *DownloadAction) RunGet(params struct {
LibraryId int64 LibraryId int64
}) { }) {
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "下载IP库 %d", params.LibraryId) defer this.CreateLog(oplogs.LevelInfo, "下载IP库 %d", params.LibraryId)
libraryResp, err := this.RPC().IPLibraryRPC().FindEnabledIPLibrary(this.AdminContext(), &pb.FindEnabledIPLibraryRequest{IpLibraryId: params.LibraryId}) libraryResp, err := this.RPC().IPLibraryRPC().FindEnabledIPLibrary(this.AdminContext(), &pb.FindEnabledIPLibraryRequest{IpLibraryId: params.LibraryId})
if err != nil { if err != nil {

View File

@@ -104,7 +104,7 @@ func (this *UploadPopupAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "上传IP库 %d", createResp.IpLibraryId) defer this.CreateLog(oplogs.LevelInfo, "上传IP库 %d", createResp.IpLibraryId)
this.Success() this.Success()
} }

View File

@@ -14,7 +14,7 @@ func (this *DeleteAction) RunPost(params struct {
CertId int64 CertId int64
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "删除SSL证书 %d", params.CertId) defer this.CreateLog(oplogs.LevelInfo, "删除SSL证书 %d", params.CertId)
// 是否正在被使用 // 是否正在被使用
countResp, err := this.RPC().ServerRPC().CountAllEnabledServersWithSSLCertId(this.AdminContext(), &pb.CountAllEnabledServersWithSSLCertIdRequest{CertId: params.CertId}) countResp, err := this.RPC().ServerRPC().CountAllEnabledServersWithSSLCertId(this.AdminContext(), &pb.CountAllEnabledServersWithSSLCertIdRequest{CertId: params.CertId})

View File

@@ -19,6 +19,8 @@ func (this *DownloadCertAction) Init() {
func (this *DownloadCertAction) RunGet(params struct { func (this *DownloadCertAction) RunGet(params struct {
CertId int64 CertId int64
}) { }) {
defer this.CreateLogInfo("下载SSL证书 %d", params.CertId)
certResp, err := this.RPC().SSLCertRPC().FindEnabledSSLCertConfig(this.AdminContext(), &pb.FindEnabledSSLCertConfigRequest{CertId: params.CertId}) certResp, err := this.RPC().SSLCertRPC().FindEnabledSSLCertConfig(this.AdminContext(), &pb.FindEnabledSSLCertConfigRequest{CertId: params.CertId})
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)

View File

@@ -19,6 +19,8 @@ func (this *DownloadKeyAction) Init() {
func (this *DownloadKeyAction) RunGet(params struct { func (this *DownloadKeyAction) RunGet(params struct {
CertId int64 CertId int64
}) { }) {
defer this.CreateLogInfo("下载SSL密钥 %d", params.CertId)
certResp, err := this.RPC().SSLCertRPC().FindEnabledSSLCertConfig(this.AdminContext(), &pb.FindEnabledSSLCertConfigRequest{CertId: params.CertId}) certResp, err := this.RPC().SSLCertRPC().FindEnabledSSLCertConfig(this.AdminContext(), &pb.FindEnabledSSLCertConfigRequest{CertId: params.CertId})
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)

View File

@@ -20,6 +20,8 @@ func (this *DownloadZipAction) Init() {
func (this *DownloadZipAction) RunGet(params struct { func (this *DownloadZipAction) RunGet(params struct {
CertId int64 CertId int64
}) { }) {
defer this.CreateLogInfo("下载SSL证书压缩包 %d", params.CertId)
certResp, err := this.RPC().SSLCertRPC().FindEnabledSSLCertConfig(this.AdminContext(), &pb.FindEnabledSSLCertConfigRequest{CertId: params.CertId}) certResp, err := this.RPC().SSLCertRPC().FindEnabledSSLCertConfig(this.AdminContext(), &pb.FindEnabledSSLCertConfigRequest{CertId: params.CertId})
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)

View File

@@ -56,7 +56,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "修改SSL证书 %d", params.CertId) defer this.CreateLog(oplogs.LevelInfo, "修改SSL证书 %d", params.CertId)
// 查询Cert // 查询Cert
certConfigResp, err := this.RPC().SSLCertRPC().FindEnabledSSLCertConfig(this.AdminContext(), &pb.FindEnabledSSLCertConfigRequest{CertId: params.CertId}) certConfigResp, err := this.RPC().SSLCertRPC().FindEnabledSSLCertConfig(this.AdminContext(), &pb.FindEnabledSSLCertConfigRequest{CertId: params.CertId})

View File

@@ -115,7 +115,7 @@ func (this *UploadPopupAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "上传SSL证书 %d", certId) defer this.CreateLog(oplogs.LevelInfo, "上传SSL证书 %d", certId)
this.Success() this.Success()
} }

View File

@@ -96,7 +96,7 @@ func (this *CreateGroupPopupAction) RunPost(params struct {
} }
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "创建规则分组 %d名称%s", groupId, params.Name) defer this.CreateLog(oplogs.LevelInfo, "创建规则分组 %d名称%s", groupId, params.Name)
this.Success() this.Success()
} }

View File

@@ -57,7 +57,7 @@ func (this *CreatePopupAction) RunPost(params struct {
} }
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "创建WAF策略 %d", createResp.FirewallPolicyId) defer this.CreateLog(oplogs.LevelInfo, "创建WAF策略 %d", createResp.FirewallPolicyId)
this.Success() this.Success()
} }

View File

@@ -14,7 +14,7 @@ func (this *DeleteAction) RunPost(params struct {
FirewallPolicyId int64 FirewallPolicyId int64
}) { }) {
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "删除WAF策略 %d", params.FirewallPolicyId) defer this.CreateLog(oplogs.LevelInfo, "删除WAF策略 %d", params.FirewallPolicyId)
countResp, err := this.RPC().ServerRPC().CountAllEnabledServersWithHTTPFirewallPolicyId(this.AdminContext(), &pb.CountAllEnabledServersWithHTTPFirewallPolicyIdRequest{FirewallPolicyId: params.FirewallPolicyId}) countResp, err := this.RPC().ServerRPC().CountAllEnabledServersWithHTTPFirewallPolicyId(this.AdminContext(), &pb.CountAllEnabledServersWithHTTPFirewallPolicyIdRequest{FirewallPolicyId: params.FirewallPolicyId})
if err != nil { if err != nil {

View File

@@ -16,7 +16,7 @@ func (this *DeleteGroupAction) RunPost(params struct {
GroupId int64 GroupId int64
}) { }) {
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "删除WAF策略 %d 的规则分组 %d", params.FirewallPolicyId, params.GroupId) defer this.CreateLog(oplogs.LevelInfo, "删除WAF策略 %d 的规则分组 %d", params.FirewallPolicyId, params.GroupId)
firewallPolicy, err := models.SharedHTTPFirewallPolicyDAO.FindEnabledPolicyConfig(this.AdminContext(), params.FirewallPolicyId) firewallPolicy, err := models.SharedHTTPFirewallPolicyDAO.FindEnabledPolicyConfig(this.AdminContext(), params.FirewallPolicyId)
if err != nil { if err != nil {

View File

@@ -18,7 +18,7 @@ func (this *DeleteSetAction) RunPost(params struct {
SetId int64 SetId int64
}) { }) {
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "删除WAF规则分组 %d 中的规则集 %d", params.GroupId, params.SetId) defer this.CreateLog(oplogs.LevelInfo, "删除WAF规则分组 %d 中的规则集 %d", params.GroupId, params.SetId)
groupConfig, err := models.SharedHTTPFirewallRuleGroupDAO.FindRuleGroupConfig(this.AdminContext(), params.GroupId) groupConfig, err := models.SharedHTTPFirewallRuleGroupDAO.FindRuleGroupConfig(this.AdminContext(), params.GroupId)
if err != nil { if err != nil {

View File

@@ -72,7 +72,7 @@ func (this *CreateIPPopupAction) RunPost(params struct {
} }
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "在WAF策略 %d 名单中添加IP %d", params.FirewallPolicyId, itemId) defer this.CreateLog(oplogs.LevelInfo, "在WAF策略 %d 名单中添加IP %d", params.FirewallPolicyId, itemId)
this.Success() this.Success()
} }

View File

@@ -16,7 +16,7 @@ func (this *DeleteIPAction) RunPost(params struct {
ItemId int64 ItemId int64
}) { }) {
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "从WAF策略 %d 名单中删除IP %d", params.FirewallPolicyId, params.ItemId) defer this.CreateLog(oplogs.LevelInfo, "从WAF策略 %d 名单中删除IP %d", params.FirewallPolicyId, params.ItemId)
// TODO 判断权限 // TODO 判断权限

View File

@@ -67,7 +67,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "WAF策略 %d 设置禁止访问的国家和地区", params.FirewallPolicyId) defer this.CreateLog(oplogs.LevelInfo, "WAF策略 %d 设置禁止访问的国家和地区", params.FirewallPolicyId)
policyConfig, err := models.SharedHTTPFirewallPolicyDAO.FindEnabledPolicyConfig(this.AdminContext(), params.FirewallPolicyId) policyConfig, err := models.SharedHTTPFirewallPolicyDAO.FindEnabledPolicyConfig(this.AdminContext(), params.FirewallPolicyId)
if err != nil { if err != nil {

View File

@@ -69,7 +69,7 @@ func (this *ProvincesAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "WAF策略 %d 设置禁止访问的省份", params.FirewallPolicyId) defer this.CreateLog(oplogs.LevelInfo, "WAF策略 %d 设置禁止访问的省份", params.FirewallPolicyId)
policyConfig, err := models.SharedHTTPFirewallPolicyDAO.FindEnabledPolicyConfig(this.AdminContext(), params.FirewallPolicyId) policyConfig, err := models.SharedHTTPFirewallPolicyDAO.FindEnabledPolicyConfig(this.AdminContext(), params.FirewallPolicyId)
if err != nil { if err != nil {

View File

@@ -55,7 +55,7 @@ func (this *UpdateIPPopupAction) RunPost(params struct {
CSRF *actionutils.CSRF CSRF *actionutils.CSRF
}) { }) {
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "修改WAF策略 %d 名单中的IP %d", params.FirewallPolicyId, params.ItemId) defer this.CreateLog(oplogs.LevelInfo, "修改WAF策略 %d 名单中的IP %d", params.FirewallPolicyId, params.ItemId)
// TODO 校验ItemId所属用户 // TODO 校验ItemId所属用户
// TODO 校验IP格式ipFrom/ipTo // TODO 校验IP格式ipFrom/ipTo

View File

@@ -18,7 +18,7 @@ func (this *SortGroupsAction) RunPost(params struct {
GroupIds []int64 GroupIds []int64
}) { }) {
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "修改WAF策略 %d 中的规则分组中的排序", params.FirewallPolicyId) defer this.CreateLog(oplogs.LevelInfo, "修改WAF策略 %d 中的规则分组中的排序", params.FirewallPolicyId)
firewallPolicy, err := models.SharedHTTPFirewallPolicyDAO.FindEnabledPolicyConfig(this.AdminContext(), params.FirewallPolicyId) firewallPolicy, err := models.SharedHTTPFirewallPolicyDAO.FindEnabledPolicyConfig(this.AdminContext(), params.FirewallPolicyId)
if err != nil { if err != nil {

View File

@@ -18,7 +18,7 @@ func (this *SortSetsAction) RunPost(params struct {
SetIds []int64 SetIds []int64
}) { }) {
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "修改WAF规则分组 %d 中的规则集排序", params.GroupId) defer this.CreateLog(oplogs.LevelInfo, "修改WAF规则分组 %d 中的规则集排序", params.GroupId)
groupConfig, err := models.SharedHTTPFirewallRuleGroupDAO.FindRuleGroupConfig(this.AdminContext(), params.GroupId) groupConfig, err := models.SharedHTTPFirewallRuleGroupDAO.FindRuleGroupConfig(this.AdminContext(), params.GroupId)
if err != nil { if err != nil {

View File

@@ -69,7 +69,7 @@ func (this *UpdateAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "修改WAF策略 %d 基本信息", params.FirewallPolicyId) defer this.CreateLog(oplogs.LevelInfo, "修改WAF策略 %d 基本信息", params.FirewallPolicyId)
params.Must. params.Must.
Field("name", params.Name). Field("name", params.Name).

View File

@@ -15,7 +15,7 @@ func (this *UpdateGroupOnAction) RunPost(params struct {
IsOn bool IsOn bool
}) { }) {
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "设置WAF规则分组 %d 开启状态", params.GroupId) defer this.CreateLog(oplogs.LevelInfo, "设置WAF规则分组 %d 开启状态", params.GroupId)
_, err := this.RPC().HTTPFirewallRuleGroupRPC().UpdateHTTPFirewallRuleGroupIsOn(this.AdminContext(), &pb.UpdateHTTPFirewallRuleGroupIsOnRequest{ _, err := this.RPC().HTTPFirewallRuleGroupRPC().UpdateHTTPFirewallRuleGroupIsOn(this.AdminContext(), &pb.UpdateHTTPFirewallRuleGroupIsOnRequest{
FirewallRuleGroupId: params.GroupId, FirewallRuleGroupId: params.GroupId,

View File

@@ -49,7 +49,7 @@ func (this *UpdateGroupPopupAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "修改WAF规则分组 %d 基本信息", params.GroupId) defer this.CreateLog(oplogs.LevelInfo, "修改WAF规则分组 %d 基本信息", params.GroupId)
params.Must. params.Must.
Field("name", params.Name). Field("name", params.Name).

View File

@@ -15,7 +15,7 @@ func (this *UpdateSetOnAction) RunPost(params struct {
IsOn bool IsOn bool
}) { }) {
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "修改WAF规则集 %d 开启状态", params.SetId) defer this.CreateLog(oplogs.LevelInfo, "修改WAF规则集 %d 开启状态", params.SetId)
_, err := this.RPC().HTTPFirewallRuleSetRPC().UpdateHTTPFirewallRuleSetIsOn(this.AdminContext(), &pb.UpdateHTTPFirewallRuleSetIsOnRequest{ _, err := this.RPC().HTTPFirewallRuleSetRPC().UpdateHTTPFirewallRuleSetIsOn(this.AdminContext(), &pb.UpdateHTTPFirewallRuleSetIsOnRequest{
FirewallRuleSetId: params.SetId, FirewallRuleSetId: params.SetId,

View File

@@ -27,7 +27,7 @@ func (this *UpdateSetPopupAction) RunGet(params struct {
SetId int64 SetId int64
}) { }) {
// 日志 // 日志
this.CreateLog(oplogs.LevelInfo, "修改WAF规则集 %d 基本信息", params.SetId) defer this.CreateLog(oplogs.LevelInfo, "修改WAF规则集 %d 基本信息", params.SetId)
this.Data["groupId"] = params.GroupId this.Data["groupId"] = params.GroupId
this.Data["type"] = params.Type this.Data["type"] = params.Type

View File

@@ -318,7 +318,7 @@ func (this *CreateAction) RunPost(params struct {
} }
// 创建日志 // 创建日志
this.CreateLog(oplogs.LevelInfo, "创建代理服务 %d", createResp.ServerId) defer this.CreateLog(oplogs.LevelInfo, "创建代理服务 %d", createResp.ServerId)
this.Success() this.Success()
} }

View File

@@ -25,7 +25,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 记录日志 // 记录日志
this.CreateLog(oplogs.LevelInfo, "删除代理服务 %d", params.ServerId) defer this.CreateLog(oplogs.LevelInfo, "删除代理服务 %d", params.ServerId)
// 执行删除 // 执行删除
_, err := this.RPC().ServerRPC().DisableServer(this.AdminContext(), &pb.DisableServerRequest{ServerId: params.ServerId}) _, err := this.RPC().ServerRPC().DisableServer(this.AdminContext(), &pb.DisableServerRequest{ServerId: params.ServerId})

View File

@@ -1,6 +1,7 @@
package accessLog package accessLog
import ( import (
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
@@ -59,6 +60,9 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "修改Web %d 的访问日志设置", params.WebId)
// TODO 检查参数 // TODO 检查参数
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebAccessLog(this.AdminContext(), &pb.UpdateHTTPWebAccessLogRequest{ _, err := this.RPC().HTTPWebRPC().UpdateHTTPWebAccessLog(this.AdminContext(), &pb.UpdateHTTPWebAccessLogRequest{

View File

@@ -2,6 +2,7 @@ package cache
import ( import (
"encoding/json" "encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
@@ -39,6 +40,9 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "修改Web %d 的缓存设置", params.WebId)
// TODO 校验配置 // TODO 校验配置
cacheConfig := &serverconfigs.HTTPCacheConfig{} cacheConfig := &serverconfigs.HTTPCacheConfig{}
err := json.Unmarshal(params.CacheJSON, cacheConfig) err := json.Unmarshal(params.CacheJSON, cacheConfig)

View File

@@ -1,6 +1,7 @@
package charset package charset
import ( import (
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils"
"github.com/TeaOSLab/EdgeCommon/pkg/configutils" "github.com/TeaOSLab/EdgeCommon/pkg/configutils"
@@ -41,6 +42,8 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
defer this.CreateLog(oplogs.LevelInfo, "修改Web %d 的字符集设置", params.WebId)
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebCharset(this.AdminContext(), &pb.UpdateHTTPWebCharsetRequest{ _, err := this.RPC().HTTPWebRPC().UpdateHTTPWebCharset(this.AdminContext(), &pb.UpdateHTTPWebCharsetRequest{
WebId: params.WebId, WebId: params.WebId,
CharsetJSON: params.CharsetJSON, CharsetJSON: params.CharsetJSON,

View File

@@ -2,6 +2,7 @@ package gzip
import ( import (
"encoding/json" "encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
@@ -76,6 +77,9 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "修改Web %d 的GZip配置", params.WebId)
if params.Level < 0 || params.Level > 9 { if params.Level < 0 || params.Level > 9 {
this.Fail("请选择正确的压缩级别") this.Fail("请选择正确的压缩级别")
} }

View File

@@ -2,6 +2,7 @@ package headers
import ( import (
"encoding/json" "encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -30,6 +31,13 @@ func (this *CreateDeletePopupAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "添加删除的Header HeaderPolicyId: %d, Name: %s", params.HeaderPolicyId, params.Name)
params.Must.
Field("name", params.Name).
Require("名称不能为空")
policyConfigResp, err := this.RPC().HTTPHeaderPolicyRPC().FindEnabledHTTPHeaderPolicyConfig(this.AdminContext(), &pb.FindEnabledHTTPHeaderPolicyConfigRequest{HeaderPolicyId: params.HeaderPolicyId}) policyConfigResp, err := this.RPC().HTTPHeaderPolicyRPC().FindEnabledHTTPHeaderPolicyConfig(this.AdminContext(), &pb.FindEnabledHTTPHeaderPolicyConfigRequest{HeaderPolicyId: params.HeaderPolicyId})
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)

View File

@@ -2,6 +2,7 @@ package headers
import ( import (
"encoding/json" "encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -32,6 +33,9 @@ func (this *CreateSetPopupAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "设置请求HeaderHeaderPolicyId:%d, Name:%s, Value:%s", params.HeaderPolicyId, params.Name, params.Value)
params.Must. params.Must.
Field("name", params.Name). Field("name", params.Name).
Require("请输入Header名称") Require("请输入Header名称")

View File

@@ -2,6 +2,7 @@ package headers
import ( import (
"encoding/json" "encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -17,6 +18,8 @@ func (this *DeleteAction) RunPost(params struct {
Type string Type string
HeaderId int64 HeaderId int64
}) { }) {
defer this.CreateLog(oplogs.LevelInfo, "删除请求HeaderHeaderPolicyId:%d, HeaderId:%d", params.HeaderPolicyId, params.HeaderId)
policyConfigResp, err := this.RPC().HTTPHeaderPolicyRPC().FindEnabledHTTPHeaderPolicyConfig(this.AdminContext(), &pb.FindEnabledHTTPHeaderPolicyConfigRequest{ policyConfigResp, err := this.RPC().HTTPHeaderPolicyRPC().FindEnabledHTTPHeaderPolicyConfig(this.AdminContext(), &pb.FindEnabledHTTPHeaderPolicyConfigRequest{
HeaderPolicyId: params.HeaderPolicyId, HeaderPolicyId: params.HeaderPolicyId,
}) })

View File

@@ -2,6 +2,7 @@ package headers
import ( import (
"encoding/json" "encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -15,6 +16,9 @@ func (this *DeleteDeletingHeaderAction) RunPost(params struct {
HeaderPolicyId int64 HeaderPolicyId int64
HeaderName string HeaderName string
}) { }) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "删除需要删除的请求HeaderHeaderPolicyId:%d, HeaderName:%s", params.HeaderPolicyId, params.HeaderName)
policyConfigResp, err := this.RPC().HTTPHeaderPolicyRPC().FindEnabledHTTPHeaderPolicyConfig(this.AdminContext(), &pb.FindEnabledHTTPHeaderPolicyConfigRequest{HeaderPolicyId: params.HeaderPolicyId}) policyConfigResp, err := this.RPC().HTTPHeaderPolicyRPC().FindEnabledHTTPHeaderPolicyConfig(this.AdminContext(), &pb.FindEnabledHTTPHeaderPolicyConfigRequest{HeaderPolicyId: params.HeaderPolicyId})
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)

View File

@@ -2,6 +2,7 @@ package headers
import ( import (
"encoding/json" "encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -46,6 +47,9 @@ func (this *UpdateSetPopupAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "修改设置请求HeaderHeaderPolicyId:%d, Name:%s, Value:%s", params.HeaderId, params.Name, params.Value)
params.Must. params.Must.
Field("name", params.Name). Field("name", params.Name).
Require("请输入Header名称") Require("请输入Header名称")

View File

@@ -68,7 +68,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must Must *actions.Must
}) { }) {
// 记录日志 // 记录日志
this.CreateLog(oplogs.LevelInfo, "修改服务 %d 的HTTP设置", params.ServerId) defer this.CreateLog(oplogs.LevelInfo, "修改服务 %d 的HTTP设置", params.ServerId)
addresses := []*serverconfigs.NetworkAddressConfig{} addresses := []*serverconfigs.NetworkAddressConfig{}
err := json.Unmarshal([]byte(params.Addresses), &addresses) err := json.Unmarshal([]byte(params.Addresses), &addresses)

Some files were not shown because too many files have changed in this diff Show More