fix 修复历史价格问题
This commit is contained in:
parent
8ba5c95a9c
commit
e7fa9e7dd2
@ -94,7 +94,7 @@ func (p *Product) fillUSCoachPriceStatus(tx *gorm.DB) {
|
|||||||
|
|
||||||
func (p *Product) fillCNCoachPriceStatus(tx *gorm.DB) {
|
func (p *Product) fillCNCoachPriceStatus(tx *gorm.DB) {
|
||||||
var lastPrice float64
|
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 {
|
if p.CNYPrice != lastPrice {
|
||||||
p.HistoryPrices = append(p.HistoryPrices, HistoryPrice{
|
p.HistoryPrices = append(p.HistoryPrices, HistoryPrice{
|
||||||
USPrice: p.CNYPrice,
|
USPrice: p.CNYPrice,
|
||||||
|
Loading…
Reference in New Issue
Block a user