From 8c1efd1baa3e1a07e2b0b726b485239ba6982813 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 3 Sep 2024 15:50:40 +0800 Subject: [PATCH] 1 --- server/light_backtask/task/stacking_go.go | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/server/light_backtask/task/stacking_go.go b/server/light_backtask/task/stacking_go.go index ff0e955a..cb27de3c 100644 --- a/server/light_backtask/task/stacking_go.go +++ b/server/light_backtask/task/stacking_go.go @@ -8,6 +8,7 @@ import ( "jccommon" "fmt" "strings" + "math/big" ) const ( @@ -110,15 +111,7 @@ func (this *stackingCec) saveToDb(ds *f5.DataSet) bool { if dbErr != nil { return false } - if eventName == EVENT_NAME_STAKE_CEC { - if !this.applyStake(idx, p) { - return false - } - } else if eventName == EVENT_NAME_UNSTAKE_CEC { - if !this.applyUnstake(idx, p) { - return false - } - } else { + if !this.apply(idx, eventName, p) { return false } } @@ -135,10 +128,17 @@ func (this *stackingCec) saveToDb(ds *f5.DataSet) bool { return true } -func (this *stackingCec) applyStake(idx int64, p *jccommon.ContractStakeAndUnstakeCecPo) bool { - return true -} - -func (this *stackingCec) applyUnstake(idx int64, p *jccommon.ContractStakeAndUnstakeCecPo) bool { +func (this *stackingCec) apply(idx int64, eventName string, + p *jccommon.ContractStakeAndUnstakeCecPo) bool { + bnAmount, ok := new(big.Int).SetString(p.Amount, 10) + if !ok { + return false + } + if eventName == EVENT_NAME_STAKE_CEC { + } else if eventName == EVENT_NAME_UNSTAKE_CEC { + bnAmount = big.NewInt(0).Sub(big.NewInt(0), bnAmount) + } else { + return false + } return true }