mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-25 19:56:35 +08:00
实现基本的集群DNS列表、设置、简单数据同步
This commit is contained in:
39
internal/web/actions/default/dns/domainOptions.go
Normal file
39
internal/web/actions/default/dns/domainOptions.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package dns
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
// 域名列表选项
|
||||
type DomainOptionsAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *DomainOptionsAction) RunPost(params struct {
|
||||
ProviderId int64
|
||||
}) {
|
||||
domainsResp, err := this.RPC().DNSDomainRPC().FindAllEnabledBasicDNSDomainsWithDNSProviderId(this.AdminContext(), &pb.FindAllEnabledBasicDNSDomainsWithDNSProviderIdRequest{
|
||||
DnsProviderId: params.ProviderId,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
domainMaps := []maps.Map{}
|
||||
for _, domain := range domainsResp.DnsDomains {
|
||||
// 未开启的先跳过
|
||||
if !domain.IsOn {
|
||||
continue
|
||||
}
|
||||
|
||||
domainMaps = append(domainMaps, maps.Map{
|
||||
"id": domain.Id,
|
||||
"name": domain.Name,
|
||||
})
|
||||
}
|
||||
this.Data["domains"] = domainMaps
|
||||
|
||||
this.Success()
|
||||
}
|
||||
Reference in New Issue
Block a user