1
This commit is contained in:
parent
6a4fd62fd9
commit
b671374141
@ -52,5 +52,42 @@ func (this* repairOrder) repairPrice(ds *f5.DataSet) bool {
|
||||
if service.BcCurrency.GetLastRefreshOkTime() + 3600 * 2 < f5.GetApp().GetRealSeconds() {
|
||||
return false
|
||||
}
|
||||
dbIdx := ds.GetByName("idx")
|
||||
eventId := ds.GetByName("event_id")
|
||||
srcPriceAmount := ds.GetByName("src_price_amount")
|
||||
srcPriceContractAddress := ds.GetByName("src_price_contract_address")
|
||||
srcPriceItemType := ds.GetByName("src_price_item_type")
|
||||
if srcPriceAmount == "" {
|
||||
p := new(jccommon.OrderUpdatedEvent)
|
||||
err := q5.DecodeJson(ds.GetByName("event_data"), &p)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
srcPriceAmount = p.Data.Buy[0].Amount
|
||||
srcPriceContractAddress = p.Data.Buy[0].ContractAddress
|
||||
srcPriceItemType = p.Data.Buy[0].ItemType
|
||||
}
|
||||
srcPriceExchangeRate, price := service.BcCurrency.ExchangeUSD(
|
||||
srcPriceAmount, srcPriceContractAddress, srcPriceItemType)
|
||||
updateFields := [][]string{
|
||||
{"src_price_amount", srcPriceAmount},
|
||||
{"src_price_contract_address", srcPriceContractAddress},
|
||||
{"src_price_item_type", srcPriceItemType},
|
||||
{"price", price},
|
||||
{"src_price_exchange_rate", q5.ToString(srcPriceExchangeRate)},
|
||||
}
|
||||
f5.GetGoStyleDb().Update(
|
||||
constant.BCNFT_DB,
|
||||
"t_order",
|
||||
[][]string{
|
||||
{"idx", q5.ToString(dbIdx)},
|
||||
{"event_id", eventId},
|
||||
},
|
||||
updateFields,
|
||||
func (err error, lastInsertId int64, rowsAffected int64) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user