mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2026-02-05 15:35:47 +08:00
添加DNS账号时自动读取DNS服务商下域名
This commit is contained in:
@@ -86,6 +86,7 @@ func (this *DNSDomainDAO) CreateDomain(tx *dbs.Tx, adminId int64, userId int64,
|
||||
op.Name = name
|
||||
op.State = DNSDomainStateEnabled
|
||||
op.IsOn = true
|
||||
op.IsUp = true
|
||||
err := this.Save(tx, op)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
@@ -247,3 +248,25 @@ func (this *DNSDomainDAO) ExistDomainRecord(tx *dbs.Tx, domainId int64, recordNa
|
||||
Param("query", query.AsJSON()).
|
||||
Exist()
|
||||
}
|
||||
|
||||
// FindEnabledDomainWithName 根据名称查找某个域名
|
||||
func (this *DNSDomainDAO) FindEnabledDomainWithName(tx *dbs.Tx, providerId int64, domainName string) (*DNSDomain, error) {
|
||||
one, err := this.Query(tx).
|
||||
State(DNSDomainStateEnabled).
|
||||
Attr("isOn", true).
|
||||
Attr("providerId", providerId).
|
||||
Attr("name", domainName).
|
||||
Find()
|
||||
if one != nil {
|
||||
return one.(*DNSDomain), nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// UpdateDomainIsUp 设置是否在线
|
||||
func (this *DNSDomainDAO) UpdateDomainIsUp(tx *dbs.Tx, domainId int64, isUp bool) error {
|
||||
return this.Query(tx).
|
||||
Pk(domainId).
|
||||
Set("isUp", isUp).
|
||||
UpdateQuickly()
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package dns
|
||||
|
||||
// 管理的域名
|
||||
// DNSDomain 管理的域名
|
||||
type DNSDomain struct {
|
||||
Id uint32 `field:"id"` // ID
|
||||
AdminId uint32 `field:"adminId"` // 管理员ID
|
||||
@@ -14,6 +14,7 @@ type DNSDomain struct {
|
||||
Data string `field:"data"` // 原始数据信息
|
||||
Records string `field:"records"` // 所有解析记录
|
||||
Routes string `field:"routes"` // 线路数据
|
||||
IsUp uint8 `field:"isUp"` // 是否在线
|
||||
State uint8 `field:"state"` // 状态
|
||||
}
|
||||
|
||||
@@ -30,6 +31,7 @@ type DNSDomainOperator struct {
|
||||
Data interface{} // 原始数据信息
|
||||
Records interface{} // 所有解析记录
|
||||
Routes interface{} // 线路数据
|
||||
IsUp interface{} // 是否在线
|
||||
State interface{} // 状态
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user