|
@@ -1037,6 +1037,21 @@ func (s *aidedWebService) ProcessSSLCertificateUpdate(ctx context.Context, req *
|
|
|
return nil // 非HTTPS协议不需要处理SSL证书
|
|
|
}
|
|
|
|
|
|
+ // 如果证书ID为0
|
|
|
+ if oldData.SslCertId == 0 {
|
|
|
+ err := s.ProcessSSLCertificate(ctx, req, require, v1.Website{
|
|
|
+ HttpJSON: v1.TypeJSON{
|
|
|
+ SslPolicyRef: v1.SslPolicyRef{
|
|
|
+ SslPolicyId: int64(oldData.SslPolicyId),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ })
|
|
|
+ if err != nil {
|
|
|
+ return fmt.Errorf("处理SSL证书失败: %w", err)
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+
|
|
|
// 如果证书内容有变化
|
|
|
if oldData.HttpsCert != req.WebForwardingData.HttpsCert || oldData.HttpsKey != req.WebForwardingData.HttpsKey {
|
|
|
if err := s.sslCert.EditSSLCert(ctx, v1.SSL{
|