mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-11 08:50:32 +08:00
优化代码
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package certs
|
||||
|
||||
import (
|
||||
teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
@@ -37,28 +36,10 @@ func (this *DeleteAction) RunPost(params struct {
|
||||
this.Fail("此证书正在被某些API节点引用,请先修改API节点后再删除")
|
||||
}
|
||||
|
||||
// 是否正在被用户节点使用
|
||||
if teaconst.IsPlus {
|
||||
countResp, err = this.RPC().UserNodeRPC().CountAllEnabledUserNodesWithSSLCertId(this.AdminContext(), &pb.CountAllEnabledUserNodesWithSSLCertIdRequest{SslCertId: params.CertId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
if countResp.Count > 0 {
|
||||
this.Fail("此证书正在被某些用户节点引用,请先修改相关用户节点后再删除")
|
||||
}
|
||||
}
|
||||
|
||||
// 是否正在被NS集群使用
|
||||
if teaconst.IsPlus {
|
||||
countResp, err = this.RPC().NSClusterRPC().CountAllNSClustersWithSSLCertId(this.AdminContext(), &pb.CountAllNSClustersWithSSLCertIdRequest{SslCertId: params.CertId})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
if countResp.Count > 0 {
|
||||
this.Fail("此证书正在被某些DNS集群节点引用,请先修改相关DNS集群设置后再删除")
|
||||
}
|
||||
err = this.filterDelete(params.CertId)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
_, err = this.RPC().SSLCertRPC().DeleteSSLCert(this.AdminContext(), &pb.DeleteSSLCertRequest{SslCertId: params.CertId})
|
||||
|
||||
8
internal/web/actions/default/servers/certs/delete_ext.go
Normal file
8
internal/web/actions/default/servers/certs/delete_ext.go
Normal file
@@ -0,0 +1,8 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
//go:build !plus
|
||||
|
||||
package certs
|
||||
|
||||
func (this *DeleteAction) filterDelete(certId int64) error {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user