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 len(article.Providers) > 0 {
|
||||||
if err := tx.Save(&article.Providers).Error; err != nil {
|
if err := tx.Save(&article.Providers).Error; err != nil {
|
||||||
return fmt.Errorf("failed to save providers: %v", err)
|
return fmt.Errorf("failed to save providers: %v", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if len(article.Sellers) > 0 {
|
||||||
return tx.Save(&article.Sellers).Error
|
return tx.Save(&article.Sellers).Error
|
||||||
|
}
|
||||||
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user