code refactor

This commit is contained in:
Ulric Qin 2022-05-08 16:04:20 +08:00
parent 02dd70480d
commit e89760f374
1 changed files with 8 additions and 4 deletions

View File

@ -36,10 +36,14 @@ func (t *Target) Add() error {
return Insert(t)
}
return DB().Model(&Target{}).Where("ident = ?", t.Ident).Updates(map[string]interface{}{
"cluster": t.Cluster,
"update_at": t.UpdateAt,
}).Error
if obj.Cluster != t.Cluster {
return DB().Model(&Target{}).Where("ident = ?", t.Ident).Updates(map[string]interface{}{
"cluster": t.Cluster,
"update_at": t.UpdateAt,
}).Error
}
return nil
}
func (t *Target) FillGroup(cache map[int64]*BusiGroup) error {