优化数据库节点管理

This commit is contained in:
刘祥超
2021-08-30 10:56:31 +08:00
parent 55527bba09
commit f02ab1aae2
4 changed files with 78 additions and 12 deletions

View File

@@ -176,3 +176,15 @@ func (this *DBNodeDAO) DecodePassword(password string) string {
}
return string(encrypt.MagicKeyDecode(data))
}
// CheckNodeIsOn 检查节点是否已经启用
func (this *DBNodeDAO) CheckNodeIsOn(tx *dbs.Tx, nodeId int64) (bool, error) {
isOn, err := this.Query(tx).
Pk(nodeId).
Result("isOn").
FindIntCol(0)
if err != nil {
return false, err
}
return isOn == 1, nil
}