From 8260be804ba3274dd15951df4774a116863f3cf6 Mon Sep 17 00:00:00 2001 From: timerzz Date: Wed, 19 Jun 2024 21:10:27 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=8E=B7=E5=8F=96=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E6=97=B6=EF=BC=8C=E6=8E=92=E9=99=A4=E6=8E=89?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E4=B8=BA0=E7=9A=84=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- product/controller.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/product/controller.go b/product/controller.go index f6bb815..3de4a8a 100644 --- a/product/controller.go +++ b/product/controller.go @@ -132,6 +132,9 @@ func (c *Controller) saveRespData(list []coach_client.Product) error { var historyPrice []productv1.HistoryPrice c.db.Model(&productv1.HistoryPrice{}).Find(&historyPrice, "pid = ?", p.Pid) if len(historyPrice) > 0 { + historyPrice = lo.Filter(historyPrice, func(item productv1.HistoryPrice, index int) bool { + return item.OriginalPrice > 0 + }) lowestPrice := lo.MinBy(historyPrice, func(a productv1.HistoryPrice, b productv1.HistoryPrice) bool { return a.OriginalPrice < b.OriginalPrice })