优化代码

This commit is contained in:
刘祥超
2022-07-22 15:05:30 +08:00
parent 876c631c85
commit fe511ae7e5
72 changed files with 675 additions and 628 deletions

View File

@@ -144,7 +144,7 @@ func (this *NSNodeService) CountAllUpgradeNSNodesWithNSClusterId(ctx context.Con
return nil, err
}
tx := this.NullTx()
var tx = this.NullTx()
deployFiles := installers.SharedDeployManager.LoadNSNodeFiles()
total := int64(0)
@@ -166,7 +166,7 @@ func (this *NSNodeService) CreateNSNode(ctx context.Context, req *pb.CreateNSNod
return nil, err
}
tx := this.NullTx()
var tx = this.NullTx()
nodeId, err := models.SharedNSNodeDAO.CreateNode(tx, adminId, req.Name, req.NodeClusterId)
if err != nil {
@@ -193,7 +193,7 @@ func (this *NSNodeService) DeleteNSNode(ctx context.Context, req *pb.DeleteNSNod
return nil, err
}
tx := this.NullTx()
var tx = this.NullTx()
err = models.SharedNSNodeDAO.DisableNSNode(tx, req.NsNodeId)
if err != nil {
@@ -216,7 +216,7 @@ func (this *NSNodeService) FindEnabledNSNode(ctx context.Context, req *pb.FindEn
return nil, err
}
tx := this.NullTx()
var tx = this.NullTx()
node, err := models.SharedNSNodeDAO.FindEnabledNSNode(tx, req.NsNodeId)
if err != nil {
@@ -290,7 +290,7 @@ func (this *NSNodeService) UpdateNSNode(ctx context.Context, req *pb.UpdateNSNod
return nil, err
}
tx := this.NullTx()
var tx = this.NullTx()
err = models.SharedNSNodeDAO.UpdateNode(tx, req.NsNodeId, req.Name, req.NsClusterId, req.IsOn)
if err != nil {
@@ -345,7 +345,7 @@ func (this *NSNodeService) FindNSNodeInstallStatus(ctx context.Context, req *pb.
return nil, err
}
tx := this.NullTx()
var tx = this.NullTx()
installStatus, err := models.SharedNSNodeDAO.FindNodeInstallStatus(tx, req.NsNodeId)
if err != nil {
@@ -373,7 +373,7 @@ func (this *NSNodeService) UpdateNSNodeIsInstalled(ctx context.Context, req *pb.
return nil, err
}
tx := this.NullTx()
var tx = this.NullTx()
err = models.SharedNSNodeDAO.UpdateNodeIsInstalled(tx, req.NsNodeId, req.IsInstalled)
if err != nil {
@@ -502,7 +502,7 @@ func (this *NSNodeService) UpdateNSNodeConnectedAPINodes(ctx context.Context, re
return nil, err
}
tx := this.NullTx()
var tx = this.NullTx()
err = models.SharedNSNodeDAO.UpdateNodeConnectedAPINodes(tx, nodeId, req.ApiNodeIds)
if err != nil {
@@ -520,7 +520,7 @@ func (this *NSNodeService) UpdateNSNodeLogin(ctx context.Context, req *pb.Update
return nil, err
}
tx := this.NullTx()
var tx = this.NullTx()
if req.NodeLogin.Id <= 0 {
_, err := models.SharedNodeLoginDAO.CreateNodeLogin(tx, nodeconfigs.NodeRoleDNS, req.NsNodeId, req.NodeLogin.Name, req.NodeLogin.Type, req.NodeLogin.Params)