fix 修复providers的ids为空时数据库报错

This commit is contained in:
timerzz 2024-08-27 14:08:46 +08:00
parent bb10f842f3
commit 1da1fd27d8

View File

@ -3,7 +3,6 @@ package storage
import ( import (
"fmt" "fmt"
"strconv" "strconv"
"strings"
v2 "gitea.timerzz.com/kedaya_haitao/common/structs/v2" v2 "gitea.timerzz.com/kedaya_haitao/common/structs/v2"
"github.com/samber/lo" "github.com/samber/lo"
@ -82,7 +81,7 @@ func (p *providerApi) Update(provider v2.Provider) error {
}) })
// 删除已经没有的CalculateProcess // 删除已经没有的CalculateProcess
if err := tx.Where(fmt.Sprintf("id not in (%s) AND owner_id = ? AND kind = ?", strings.Join(ids, ",")), provider.ID, "provider").Delete(&v2.CalculateProcess{}).Error; err != nil { if err := tx.Not(ids).Where("owner_id = ? AND kind = ?", provider.ID, "provider").Delete(&v2.CalculateProcess{}).Error; err != nil {
return err return err
} }