From 566d95bc0f887706ebf5a8f094dbfedbb13f4958 Mon Sep 17 00:00:00 2001 From: timerzz Date: Tue, 19 Nov 2024 14:57:55 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E4=BE=9B=E5=BA=94=E5=95=86=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=B7=BB=E5=8A=A0=E6=9B=B4=E6=96=B0=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- structs/storage/provider-article.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/structs/storage/provider-article.go b/structs/storage/provider-article.go index 1252fd4..1a523c9 100644 --- a/structs/storage/provider-article.go +++ b/structs/storage/provider-article.go @@ -15,6 +15,7 @@ type ProviderArticleApi interface { AutoMigrate() error FindInBatches(query *GetProviderArticleQuery, results *[]v2.ProviderArticle, f func(tx *gorm.DB, batch int) error) error ProviderPrice(providerArticleID uint) (history []v2.ProviderPrice, err error) + UpdateStatus(article v2.ProviderArticle) error } type providerArticleApi struct { @@ -98,6 +99,9 @@ func (p *providerArticleApi) Upsert(article v2.ProviderArticle) error { } return nil } +func (p *providerArticleApi) UpdateStatus(article v2.ProviderArticle) error { + return p.db.Where("id=?", article.ID).Select("status").Updates(&article).Error +} func (p *providerArticleApi) FindInBatches(query *GetProviderArticleQuery, results *[]v2.ProviderArticle, f func(tx *gorm.DB, batch int) error) error { err := p.db.Scopes(query.Scope).Preload("CalculateProcess").FindInBatches(results, 20, f).Error