feat 修改sellers长度为0不保存的bug
This commit is contained in:
parent
c4bc3e368a
commit
a9a90ab1b4
@ -35,10 +35,15 @@ func (a *articleApi) Upsert(article v2.Article) error {
|
|||||||
}).Create(&article).Error; err != nil {
|
}).Create(&article).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := tx.Save(&article.Providers).Error; err != nil {
|
if len(article.Providers) > 0 {
|
||||||
return fmt.Errorf("failed to save providers: %v", err)
|
if err := tx.Save(&article.Providers).Error; err != nil {
|
||||||
|
return fmt.Errorf("failed to save providers: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return tx.Save(&article.Sellers).Error
|
if len(article.Sellers) > 0 {
|
||||||
|
return tx.Save(&article.Sellers).Error
|
||||||
|
}
|
||||||
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user