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 })