diff --git a/api/certificate/certificate.go b/api/certificate/certificate.go index ac8110bf..99af9be7 100644 --- a/api/certificate/certificate.go +++ b/api/certificate/certificate.go @@ -110,7 +110,6 @@ func AddCert(c *gin.Context) { } err := certModel.Insert() - if err != nil { api.ErrHandler(c, err) return @@ -124,7 +123,6 @@ func AddCert(c *gin.Context) { } err = content.WriteFile() - if err != nil { api.ErrHandler(c, err) return @@ -180,7 +178,6 @@ func ModifyCert(c *gin.Context) { } err = content.WriteFile() - if err != nil { api.ErrHandler(c, err) return diff --git a/model/cert.go b/model/cert.go index d081ebc5..f3069956 100644 --- a/model/cert.go +++ b/model/cert.go @@ -6,6 +6,7 @@ import ( "github.com/go-acme/lego/v4/certcrypto" "github.com/go-acme/lego/v4/certificate" "github.com/lib/pq" + "gorm.io/gorm/clause" "os" ) @@ -93,7 +94,8 @@ func GetAutoCertList() (c []*Cert) { } func (c *Cert) Updates(n *Cert) error { - return db.Model(&Cert{}).Where("id", c.ID).Updates(n).Error + return db.Model(c).Clauses(clause.Returning{}). + Where("id", c.ID).Updates(n).Error } func (c *Cert) Remove() error {