阶段性提交

This commit is contained in:
GoEdgeLab
2022-09-28 17:38:52 +08:00
parent f0c921e517
commit 187350c37b
7 changed files with 49 additions and 338 deletions

View File

@@ -300,7 +300,7 @@ func (this *UserNodeDAO) CountAllEnabledUserNodesWithSSLPolicyIds(tx *dbs.Tx, ss
if len(sslPolicyIds) == 0 {
return
}
policyStringIds := []string{}
var policyStringIds = []string{}
for _, policyId := range sslPolicyIds {
policyStringIds = append(policyStringIds, strconv.FormatInt(policyId, 10))
}
@@ -310,3 +310,21 @@ func (this *UserNodeDAO) CountAllEnabledUserNodesWithSSLPolicyIds(tx *dbs.Tx, ss
Param("policyIds", strings.Join(policyStringIds, ",")).
Count()
}
// FindUserNodeAccessAddr 获取用户节点访问地址
func (this *UserNodeDAO) FindUserNodeAccessAddr(tx *dbs.Tx) (string, error) {
nodes, err := this.ListEnabledUserNodes(tx, 0, 100)
if err != nil {
return "", err
}
for _, node := range nodes {
addrs, err := node.DecodeAccessAddrStrings()
if err != nil {
continue
}
if len(addrs) > 0 {
return addrs[0], nil
}
}
return "", nil
}