fix: 解决删除非面板 SSL 证书报错的问题 (#3218)

pull/3228/head
zhengkunwang 2023-12-07 16:22:06 +08:00 committed by GitHub
parent 48ed9d8993
commit 011ef0818d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 5 deletions

View File

@ -351,11 +351,8 @@ func (w WebsiteSSLService) Delete(ids []uint) error {
if sslSetting.Value == "enable" {
sslID, _ := settingRepo.Get(settingRepo.WithByKey("SSLID"))
idValue, _ := strconv.Atoi(sslID.Value)
if idValue > 0 {
oldSSL, _ := websiteSSLRepo.GetFirst(commonRepo.WithByID(uint(idValue)))
if oldSSL.ID > 0 {
return buserr.New("ErrDeleteWithPanelSSL")
}
if idValue > 0 && uint(idValue) == id {
return buserr.New("ErrDeleteWithPanelSSL")
}
}
_ = websiteSSLRepo.DeleteBy(commonRepo.WithByID(id))