网站服务变更也能自动同步DNS

This commit is contained in:
GoEdgeLab
2020-11-16 15:26:51 +08:00
parent 8bf09eac4c
commit 8f92d0c518
3 changed files with 72 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/iwind/TeaGo/Tea"
"github.com/iwind/TeaGo/dbs"
"github.com/iwind/TeaGo/types"
"time"
)
const (
@@ -131,3 +132,12 @@ func (this *DNSProviderDAO) FindAllEnabledDNSProvidersWithType(providerType stri
FindAll()
return
}
// 更新数据更新时间
func (this *DNSProviderDAO) UpdateProviderDataUpdatedTime(providerId int64) error {
_, err := this.Query().
Pk(providerId).
Set("dataUpdatedAt", time.Now().Unix()).
Update()
return err
}

View File

@@ -862,6 +862,14 @@ func (this *ServerDAO) createEvent() error {
return SharedSysEventDAO.CreateEvent(NewServerChangeEvent())
}
// 查询当前服务的ClusterId
func (this *ServerDAO) FindServerClusterId(serverId int64) (int64, error) {
return this.Query().
Pk(serverId).
Result("clusterId").
FindInt64Col(0)
}
// 生成DNS Name
func (this *ServerDAO) genDNSName() (string, error) {
for {