添加DNS账号时自动读取DNS服务商下域名

This commit is contained in:
刘祥超
2021-08-19 14:26:25 +08:00
parent f08289351d
commit 766c3666d8
5 changed files with 62 additions and 2 deletions

View File

@@ -34,6 +34,7 @@ func init() {
GetPost("/updatePopup", new(providers.UpdatePopupAction)).
Post("/delete", new(providers.DeleteAction)).
Get("/provider", new(providers.ProviderAction)).
Post("/syncDomains", new(providers.SyncDomainsAction)).
EndData().
// 域名
@@ -56,7 +57,6 @@ func init() {
GetPost("", new(issues.IndexAction)).
GetPost("/updateNodePopup", new(issues.UpdateNodePopupAction)).
EndData().
EndAll()
})
}

View File

@@ -82,6 +82,7 @@ func (this *ProviderAction) RunGet(params struct {
"id": domain.Id,
"name": domain.Name,
"isOn": domain.IsOn,
"isUp": domain.IsUp,
"dataUpdatedTime": dataUpdatedTime,
"countRoutes": len(domain.Routes),
"countServerRecords": domain.CountServerRecords,

View File

@@ -0,0 +1,25 @@
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package providers
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
type SyncDomainsAction struct {
actionutils.ParentAction
}
func (this *SyncDomainsAction) RunPost(params struct {
ProviderId int64
}) {
resp, err := this.RPC().DNSDomainRPC().SyncDNSDomainsFromProvider(this.AdminContext(), &pb.SyncDNSDomainsFromProviderRequest{DnsProviderId: params.ProviderId})
if err != nil {
this.Fail("更新域名失败:" + err.Error())
}
this.Data["hasChanges"] = resp.HasChanges
this.Success()
}