feat article添加create

This commit is contained in:
timerzz 2024-09-11 17:54:18 +08:00
parent cfd5a77e71
commit 93c7391125

View File

@ -37,7 +37,7 @@ func (a *articleApi) Upsert(article v2.Article) error {
return a.db.Transaction(func(tx *gorm.DB) error {
if err := tx.Clauses(clause.OnConflict{
Columns: []clause.Column{{Name: "pid"}, {Name: "brand"}},
DoUpdates: clause.AssignmentColumns([]string{"name", "english_name", "available", "updated_at", "cost_price", "sell_price", "rate", "remark", "exclude"}),
DoUpdates: clause.AssignmentColumns([]string{"available", "updated_at", "cost_price", "sell_price", "rate", "remark", "exclude"}),
}).Create(&article).Error; err != nil {
return err
}