fix 修复历史价格问题

This commit is contained in:
timerzz 2024-06-14 17:57:01 +08:00
parent 8ba5c95a9c
commit e7fa9e7dd2

View File

@ -94,7 +94,7 @@ func (p *Product) fillUSCoachPriceStatus(tx *gorm.DB) {
func (p *Product) fillCNCoachPriceStatus(tx *gorm.DB) {
var lastPrice float64
tx.Model(&HistoryPrice{}).Where("pid = ?", p.Pid).Order("created_at desc").Limit(1).Pluck("cny_price", &lastPrice)
tx.Model(&HistoryPrice{}).Where("pid = ?", p.Pid).Order("created_at desc").Limit(1).Pluck("us_price", &lastPrice)
if p.CNYPrice != lastPrice {
p.HistoryPrices = append(p.HistoryPrices, HistoryPrice{
USPrice: p.CNYPrice,