mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			40 lines
		
	
	
		
			890 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			890 B
		
	
	
	
		
			Go
		
	
	
	
	
	
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()
 | 
						|
}
 |