域名解析中可以删除和恢复某个域名

This commit is contained in:
刘祥超
2021-11-06 16:23:38 +08:00
parent 9f53f59f18
commit 3789ac6433
8 changed files with 106 additions and 60 deletions

View File

@@ -6,7 +6,7 @@ import (
"github.com/iwind/TeaGo/maps"
)
// 域名列表选项
// DomainOptionsAction 域名列表选项
type DomainOptionsAction struct {
actionutils.ParentAction
}
@@ -23,8 +23,8 @@ func (this *DomainOptionsAction) RunPost(params struct {
}
domainMaps := []maps.Map{}
for _, domain := range domainsResp.DnsDomains {
// 未开启的先跳过
if !domain.IsOn {
// 未开启或者已删除的先跳过
if !domain.IsOn || domain.IsDeleted {
continue
}

View File

@@ -0,0 +1,27 @@
package domains
import (
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
type RecoverAction struct {
actionutils.ParentAction
}
func (this *RecoverAction) RunPost(params struct {
DomainId int64
}) {
// 记录日志
defer this.CreateLog(oplogs.LevelInfo, "从DNS服务商中恢复域名 %d", params.DomainId)
// 执行恢复
_, err := this.RPC().DNSDomainRPC().RecoverDNSDomain(this.AdminContext(), &pb.RecoverDNSDomainRequest{DnsDomainId: params.DomainId})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}

View File

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

View File

@@ -43,6 +43,7 @@ func init() {
GetPost("/createPopup", new(domains.CreatePopupAction)).
GetPost("/updatePopup", new(domains.UpdatePopupAction)).
Post("/delete", new(domains.DeleteAction)).
Post("/recover", new(domains.RecoverAction)).
Post("/sync", new(domains.SyncAction)).
Get("/routesPopup", new(domains.RoutesPopupAction)).
GetPost("/selectPopup", new(domains.SelectPopupAction)).

View File

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