mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-17 22:30:25 +08:00
WAF规则中国家/地区、省份、城市、ISP增加候选项检索和选择
This commit is contained in:
36
internal/web/actions/default/ui/providerOptions.go
Normal file
36
internal/web/actions/default/ui/providerOptions.go
Normal file
@@ -0,0 +1,36 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package ui
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
type ProviderOptionsAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *ProviderOptionsAction) RunPost(params struct{}) {
|
||||
providersResp, err := this.RPC().RegionProviderRPC().FindAllEnabledRegionProviders(this.AdminContext(), &pb.FindAllEnabledRegionProvidersRequest{})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
var providerMaps = []maps.Map{}
|
||||
for _, provider := range providersResp.RegionProviders {
|
||||
if provider.Codes == nil {
|
||||
provider.Codes = []string{}
|
||||
}
|
||||
providerMaps = append(providerMaps, maps.Map{
|
||||
"id": provider.Id,
|
||||
"name": provider.Name,
|
||||
"codes": provider.Codes,
|
||||
})
|
||||
}
|
||||
this.Data["providers"] = providerMaps
|
||||
|
||||
this.Success()
|
||||
}
|
||||
Reference in New Issue
Block a user