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 }