部分中文转换为多语言代号

This commit is contained in:
刘祥超
2023-06-30 18:08:30 +08:00
parent 65555e1fe3
commit 5e38b1fbca
322 changed files with 884 additions and 733 deletions

View File

@@ -5,6 +5,7 @@ package iplists
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
@@ -99,7 +100,7 @@ func (this *BindHTTPFirewallPopupAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("绑定IP名单 %d 到WAF策略 %d", params.ListId, params.HttpFirewallPolicyId)
defer this.CreateLogInfo(codes.IPList_LogBindIPListWAFPolicy, params.ListId, params.HttpFirewallPolicyId)
// List类型
listResp, err := this.RPC().IPListRPC().FindEnabledIPList(this.AdminContext(), &pb.FindEnabledIPListRequest{IpListId: params.ListId})

View File

@@ -1,10 +1,9 @@
package iplists
import (
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
import ( "github.com/TeaOSLab/EdgeAdmin/internal/utils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
"github.com/iwind/TeaGo/actions"
@@ -256,7 +255,7 @@ func (this *CreateIPPopupAction) RunPost(params struct {
}
// 日志
defer this.CreateLog(oplogs.LevelInfo, "在IP名单中批量添加IP %d", params.ListId)
defer this.CreateLogInfo(codes.IPList_LogCreateIPItemsBatch, params.ListId)
} else {
createResp, err := this.RPC().IPItemRPC().CreateIPItem(this.AdminContext(), &pb.CreateIPItemRequest{
IpListId: params.ListId,
@@ -274,7 +273,7 @@ func (this *CreateIPPopupAction) RunPost(params struct {
itemId := createResp.IpItemId
// 日志
defer this.CreateLog(oplogs.LevelInfo, "在IP名单 %d 中添加IP %d", params.ListId, itemId)
defer this.CreateLogInfo(codes.IPItem_LogCreateIPItem, params.ListId, itemId)
}
this.Success()

View File

@@ -4,6 +4,7 @@ package iplists
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/maps"
@@ -36,7 +37,7 @@ func (this *CreatePopupAction) RunPost(params struct {
}) {
var listId int64 = 0
defer func() {
defer this.CreateLogInfo("创建IP名单 %d", listId)
defer this.CreateLogInfo(codes.IPList_LogCreateIPList, listId)
}()
params.Must.

View File

@@ -5,6 +5,7 @@ package iplists
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
@@ -15,7 +16,7 @@ type DeleteAction struct {
func (this *DeleteAction) RunPost(params struct {
ListId int64
}) {
defer this.CreateLogInfo("删除IP名单 %d", params.ListId)
defer this.CreateLogInfo(codes.IPList_LogDeleteIPList, params.ListId)
// 删除
_, err := this.RPC().IPListRPC().DeleteIPList(this.AdminContext(), &pb.DeleteIPListRequest{IpListId: params.ListId})

View File

@@ -1,9 +1,8 @@
package iplists
import (
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
@@ -15,7 +14,7 @@ func (this *DeleteIPAction) RunPost(params struct {
ItemId int64
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "从IP名单中删除IP %d", params.ItemId)
defer this.CreateLogInfo(codes.IPItem_LogDeleteIPItem, params.ItemId)
_, err := this.RPC().IPItemRPC().DeleteIPItem(this.AdminContext(), &pb.DeleteIPItemRequest{IpItemId: params.ItemId})
if err != nil {

View File

@@ -5,6 +5,7 @@ package iplists
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/types"
"strings"
@@ -26,7 +27,7 @@ func (this *DeleteItemsAction) RunPost(params struct {
itemIdStrings = append(itemIdStrings, types.String(itemId))
}
defer this.CreateLogInfo("批量删除IP名单中的IP" + strings.Join(itemIdStrings, ", "))
defer this.CreateLogInfo(codes.IPList_LogDeleteIPBatch, strings.Join(itemIdStrings, ", "))
_, err := this.RPC().IPItemRPC().DeleteIPItems(this.AdminContext(), &pb.DeleteIPItemsRequest{IpItemIds: params.ItemIds})
if err != nil {

View File

@@ -8,6 +8,7 @@ import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/maps"
"github.com/iwind/TeaGo/types"
@@ -27,7 +28,7 @@ func (this *ExportDataAction) RunGet(params struct {
ListId int64
Format string
}) {
defer this.CreateLogInfo("导出IP名单 %d", params.ListId)
defer this.CreateLogInfo(codes.IPList_LogExportIPList, params.ListId)
var err error
var ext = ""

View File

@@ -8,6 +8,7 @@ import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/lists"
@@ -46,7 +47,7 @@ func (this *ImportAction) RunPost(params struct {
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo("导入IP名单 %d", params.ListId)
defer this.CreateLogInfo(codes.IPList_LogImportIPList, params.ListId)
existsResp, err := this.RPC().IPListRPC().ExistsEnabledIPList(this.AdminContext(), &pb.ExistsEnabledIPListRequest{IpListId: params.ListId})
if err != nil {

View File

@@ -5,6 +5,7 @@ package iplists
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
@@ -13,7 +14,7 @@ type ReadAllAction struct {
}
func (this *ReadAllAction) RunPost(params struct{}) {
defer this.CreateLogInfo("将IP名单置为已读")
defer this.CreateLogInfo(codes.IPItem_LogReadAllIPItems)
_, err := this.RPC().IPItemRPC().UpdateIPItemsRead(this.AdminContext(), &pb.UpdateIPItemsReadRequest{})
if err != nil {

View File

@@ -5,6 +5,7 @@ package iplists
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
@@ -18,7 +19,7 @@ func (this *UnbindHTTPFirewallAction) RunPost(params struct {
HttpFirewallPolicyId int64
ListId int64
}) {
defer this.CreateLogInfo("接触绑定IP名单 %d WAF策略 %d", params.ListId, params.HttpFirewallPolicyId)
defer this.CreateLogInfo(codes.IPList_LogUnbindIPListWAFPolicy, params.ListId, params.HttpFirewallPolicyId)
// List类型
listResp, err := this.RPC().IPListRPC().FindEnabledIPList(this.AdminContext(), &pb.FindEnabledIPListRequest{IpListId: params.ListId})

View File

@@ -4,6 +4,7 @@ package iplists
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
)
@@ -37,7 +38,7 @@ func (this *UpdateAction) RunPost(params struct {
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo("修改IP名单 %d", params.ListId)
defer this.CreateLogInfo(codes.IPList_LogUpdateIPList, params.ListId)
params.Must.
Field("name", params.Name).

View File

@@ -1,9 +1,8 @@
package iplists
import (
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
import ( "github.com/TeaOSLab/EdgeAdmin/internal/utils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/maps"
@@ -60,7 +59,7 @@ func (this *UpdateIPPopupAction) RunPost(params struct {
CSRF *actionutils.CSRF
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "修改IP名单中IP %d", params.ItemId)
defer this.CreateLogInfo(codes.IPItem_LogUpdateIPItem, params.ItemId)
// TODO 校验ItemId所属用户