feat 更新provider article时,更新库存

This commit is contained in:
timerzz 2024-11-19 14:51:38 +08:00
parent 8bd70ec18d
commit 217039202d

View File

@ -89,7 +89,7 @@ func (p *providerArticleApi) Get(query *GetProviderArticleQuery) (article v2.Pro
func (p *providerArticleApi) Upsert(article v2.ProviderArticle) error { func (p *providerArticleApi) Upsert(article v2.ProviderArticle) error {
if err := p.db.Clauses(clause.OnConflict{ if err := p.db.Clauses(clause.OnConflict{
Columns: []clause.Column{{Name: "provider_id"}, {Name: "sku_id"}}, Columns: []clause.Column{{Name: "provider_id"}, {Name: "sku_id"}},
DoUpdates: clause.AssignmentColumns([]string{"cost", "available", "updated_at"}), DoUpdates: clause.AssignmentColumns([]string{"cost", "available", "updated_at", "ast"}),
}).Create(&article).Error; err != nil { }).Create(&article).Error; err != nil {
return err return err
} }