1
This commit is contained in:
parent
f5cc26c9c2
commit
f650fb85ec
@ -84,6 +84,14 @@ func (this *recharge) saveToDb(ds *f5.DataSet) bool {
|
|||||||
p := new(itemSoldOut)
|
p := new(itemSoldOut)
|
||||||
if q5.DecodeJson(returnValues, p) == nil {
|
if q5.DecodeJson(returnValues, p) == nil {
|
||||||
decodeJsonOk = true
|
decodeJsonOk = true
|
||||||
|
orderExists := false
|
||||||
|
if this.updateOrderStatus(txhash, p.OrderId, q5.ToInt32(createTime), &orderExists) != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
status := 0
|
||||||
|
if orderExists {
|
||||||
|
status = 1
|
||||||
|
}
|
||||||
var dbErr error
|
var dbErr error
|
||||||
f5.GetGoStyleDb().Upsert(
|
f5.GetGoStyleDb().Upsert(
|
||||||
constant.BCEVENT_DB,
|
constant.BCEVENT_DB,
|
||||||
@ -106,6 +114,7 @@ func (this *recharge) saveToDb(ds *f5.DataSet) bool {
|
|||||||
{"order_id", p.OrderId},
|
{"order_id", p.OrderId},
|
||||||
{"currency", p.Currency},
|
{"currency", p.Currency},
|
||||||
{"amount", p.Amount},
|
{"amount", p.Amount},
|
||||||
|
{"status", q5.ToString(status)},
|
||||||
{"createtime", createTime},
|
{"createtime", createTime},
|
||||||
{"modifytime", modifyTime},
|
{"modifytime", modifyTime},
|
||||||
},
|
},
|
||||||
@ -128,3 +137,38 @@ func (this *recharge) saveToDb(ds *f5.DataSet) bool {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *recharge) updateOrderStatus(txhash string, orderId string, payTime int32, orderExists *bool) error {
|
||||||
|
*orderExists = false
|
||||||
|
var resultErr error
|
||||||
|
f5.GetGoStyleDb().OrmSelectOne(
|
||||||
|
constant.BCNFT_DB,
|
||||||
|
"t_recharge_order",
|
||||||
|
[][]string{
|
||||||
|
{"order_id", orderId},
|
||||||
|
},
|
||||||
|
func (err error, ds *f5.DataSet) {
|
||||||
|
resultErr = err
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
*orderExists = ds.Next()
|
||||||
|
})
|
||||||
|
if resultErr == nil && *orderExists {
|
||||||
|
f5.GetGoStyleDb().Update(
|
||||||
|
constant.BCNFT_DB,
|
||||||
|
"t_recharge_order",
|
||||||
|
[][]string{
|
||||||
|
{"order_id", orderId},
|
||||||
|
},
|
||||||
|
[][]string{
|
||||||
|
{"txhash", txhash},
|
||||||
|
{"pay_status", q5.ToString(1)},
|
||||||
|
{"pay_time", q5.ToString(payTime)},
|
||||||
|
},
|
||||||
|
func (err error, lastInsertId int64, rowsAffected int64) {
|
||||||
|
resultErr = err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return resultErr
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user