mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-28 08:26:36 +08:00
可以修改节点的DNS设置
This commit is contained in:
@@ -115,6 +115,18 @@ func (this *NodeIPAddressDAO) UpdateAddress(addressId int64, name string, ip str
|
||||
return err
|
||||
}
|
||||
|
||||
// 修改IP地址中的IP
|
||||
func (this *NodeIPAddressDAO) UpdateAddressIP(addressId int64, ip string) error {
|
||||
if addressId <= 0 {
|
||||
return errors.New("invalid addressId")
|
||||
}
|
||||
op := NewNodeIPAddressOperator()
|
||||
op.Id = addressId
|
||||
op.Ip = ip
|
||||
_, err := this.Save(op)
|
||||
return err
|
||||
}
|
||||
|
||||
// 修改IP地址所属节点
|
||||
func (this *NodeIPAddressDAO) UpdateAddressNodeId(addressId int64, nodeId int64) error {
|
||||
_, err := this.Query().
|
||||
@@ -148,3 +160,15 @@ func (this *NodeIPAddressDAO) FindFirstNodeIPAddress(nodeId int64) (string, erro
|
||||
Result("ip").
|
||||
FindStringCol("")
|
||||
}
|
||||
|
||||
// 查找节点的第一个可访问的IP地址ID
|
||||
func (this *NodeIPAddressDAO) FindFirstNodeIPAddressId(nodeId int64) (int64, error) {
|
||||
return this.Query().
|
||||
Attr("nodeId", nodeId).
|
||||
State(NodeIPAddressStateEnabled).
|
||||
Attr("canAccess", true).
|
||||
Desc("order").
|
||||
AscPk().
|
||||
Result("id").
|
||||
FindInt64Col(0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user