From 4cc42e1d34061e9898395233368a471e69d12d2f Mon Sep 17 00:00:00 2001 From: timerzz Date: Mon, 9 Sep 2024 17:30:57 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96histo?= =?UTF-8?q?ry=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- structs/storage/provider-article.go | 6 +++--- structs/storage/seller-article.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/structs/storage/provider-article.go b/structs/storage/provider-article.go index 6afb73b..839abf2 100644 --- a/structs/storage/provider-article.go +++ b/structs/storage/provider-article.go @@ -14,7 +14,7 @@ type ProviderArticleApi interface { BatchUpdate(articles []v2.ProviderArticle) error AutoMigrate() error FindInBatches(query *GetProviderArticleQuery, results *[]v2.ProviderArticle, f func(tx *gorm.DB, batch int) error) error - ProviderPrice(query *GetProviderArticleQuery) (history []v2.ProviderPrice, err error) + ProviderPrice(providerArticleID uint) (history []v2.ProviderPrice, err error) } type providerArticleApi struct { @@ -113,8 +113,8 @@ func (p *providerArticleApi) AutoMigrate() error { return p.db.AutoMigrate(&v2.ProviderArticle{}, &v2.ProviderPrice{}) } -func (p *providerArticleApi) ProviderPrice(query *GetProviderArticleQuery) (history []v2.ProviderPrice, err error) { - err = p.db.Scopes(query.Scope).Find(&history).Error +func (p *providerArticleApi) ProviderPrice(providerArticleID uint) (history []v2.ProviderPrice, err error) { + err = p.db.Find(&history, "provider_article_id = ?", providerArticleID).Error return } diff --git a/structs/storage/seller-article.go b/structs/storage/seller-article.go index de31fb2..63a4395 100644 --- a/structs/storage/seller-article.go +++ b/structs/storage/seller-article.go @@ -13,7 +13,7 @@ type SellerArticleApi interface { Update(sellerArticle v2.SellerArticle, selects ...string) error FindInBatches(query *GetSellerArticleQuery, results *[]v2.SellerArticle, f func(tx *gorm.DB, batch int) error) error AutoMigrate() error - SellerPrice(query *GetSellerArticleQuery) (history []v2.SellerPrice, err error) + SellerPrice(sellerArticleID uint) (history []v2.SellerPrice, err error) } type sellerArticleApi struct { @@ -109,8 +109,8 @@ func (p *sellerArticleApi) AutoMigrate() error { return p.db.AutoMigrate(&v2.SellerArticle{}, &v2.SellerPrice{}) } -func (p *sellerArticleApi) SellerPrice(query *GetSellerArticleQuery) (history []v2.SellerPrice, err error) { - err = p.db.Scopes(query.Scope).Find(&history).Error +func (p *sellerArticleApi) SellerPrice(sellerArticleID uint) (history []v2.SellerPrice, err error) { + err = p.db.Find(&history, "seller_article_id = ?", sellerArticleID).Error return }