Browse Source

更新

three
huangjiajun 1 year ago
parent
commit
7b71d07df8
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      consume/zhios_appreciation.go

+ 5
- 5
consume/zhios_appreciation.go View File

@@ -191,7 +191,7 @@ func withdraw(eg *xorm.Engine, msg *md.ZhiosAppreciation) error {
return err
}
////销毁的
beforeValue = utils.GetPrec(utils.Float64ToStrByPrec(utils.StrToFloat64(beforeValue)-utils.StrToFloat64(args["amount"]), 5), "4")
beforeValue = utils.GetPrec(utils.Float64ToStrByPrec(utils.StrToFloat64(beforeValue)-resp.TransferOutValue, 5), "4")
beforeFlowValue = utils.GetPrec(utils.Float64ToStrByPrec(utils.StrToFloat64(beforeFlowValue)-utils.StrToFloat64(args["amount"]), 5), "4")
//DestroyValue := utils.GetPrec(utils.Float64ToStrByPrec(resp.DestroyValue, 5), "4")
//err = db.InsertAppreciation(sess, appreciationCoinId, args["uid"], "2", "1", DestroyValue, "0", beforeValue, beforeFlowValue)
@@ -233,14 +233,14 @@ func destroy(eg *xorm.Engine, msg *md.ZhiosAppreciation) error {
}
appreciationCoinId := db.SysCfgGetWithDb(eg, msg.Mid, "appreciation_coin_id")
//转出
err := db.InsertAppreciation(sess, appreciationCoinId, msg.Uid, "4", "1", msg.Oid, args["amount"], args["amount"], beforeValue, beforeFlowValue)
err := db.InsertAppreciation(sess, appreciationCoinId, msg.Uid, "4", "1", msg.Oid, args["coinPrice"], args["amount"], beforeValue, beforeFlowValue)
if err != nil {
sess.Rollback()
return err
}

sql := `UPDATE appreciation_base SET sum=sum-?,flow_sum=flow_sum-? WHERE is_use=1;`
_, err = eg.Exec(sql, utils.StrToFloat64(args["amount"]), utils.StrToFloat64(args["amount"]))
_, err = eg.Exec(sql, utils.StrToFloat64(args["coinPrice"]), utils.StrToFloat64(args["amount"]))
if err != nil {
sess.Rollback()
return err
@@ -265,14 +265,14 @@ func buyRefund(eg *xorm.Engine, msg *md.ZhiosAppreciation) error {
}
appreciationCoinId := db.SysCfgGetWithDb(eg, msg.Mid, "appreciation_coin_id")
//转出
err := db.InsertAppreciation(sess, appreciationCoinId, msg.Uid, "5", "0", msg.Oid, args["amount"], args["amount"], beforeValue, beforeFlowValue)
err := db.InsertAppreciation(sess, appreciationCoinId, msg.Uid, "5", "0", msg.Oid, args["coinPrice"], args["amount"], beforeValue, beforeFlowValue)
if err != nil {
sess.Rollback()
return err
}

sql := `UPDATE appreciation_base SET sum=sum+?,flow_sum=flow_sum+? WHERE is_use=1;`
_, err = eg.Exec(sql, utils.StrToFloat64(args["amount"]), utils.StrToFloat64(args["amount"]))
_, err = eg.Exec(sql, utils.StrToFloat64(args["coinPrice"]), utils.StrToFloat64(args["amount"]))
if err != nil {
sess.Rollback()
return err


Loading…
Cancel
Save