From 7b1512fae1a918984fb3aa0f55d1a2362d49ed2a Mon Sep 17 00:00:00 2001 From: assimon Date: Tue, 29 Mar 2022 21:33:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=95=B4=E6=95=B0=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=A1=A5=E4=BD=8D0=E5=AF=BC=E8=87=B4=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=8C=B9=E9=85=8D=E4=BA=A4=E6=98=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/service/task_service.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/model/service/task_service.go b/src/model/service/task_service.go index dbf5545..e8ff3d6 100644 --- a/src/model/service/task_service.go +++ b/src/model/service/task_service.go @@ -2,6 +2,7 @@ package service import ( "context" + "fmt" "github.com/assimon/luuu/model/data" "github.com/assimon/luuu/model/request" "github.com/assimon/luuu/util/http_client" @@ -97,8 +98,9 @@ func Trc20CallBack(token string, wg *sync.WaitGroup) { } x, _ := decimal.NewFromString(transfer.Quant) y, _ := decimal.NewFromString("1000000") - quant := x.Div(y).String() - result, err := data.GetExpirationTimeByAmount(ctx, token, quant) + quant := x.Div(y).InexactFloat64() + amount := fmt.Sprintf("%.4f", quant) + result, err := data.GetExpirationTimeByAmount(ctx, token, amount) if err != nil { panic(err) } @@ -107,12 +109,12 @@ func Trc20CallBack(token string, wg *sync.WaitGroup) { // 但是过期了 if expTime < nowTime { // 删掉过期 - _ = data.ClearPayCache(token, quant) + _ = data.ClearPayCache(token, amount) continue } } // 该钱包下有无匹配金额订单 - tradeId, err := data.GetTradeIdByAmount(ctx, token, quant) + tradeId, err := data.GetTradeIdByAmount(ctx, token, amount) if err != nil { panic(err) } @@ -123,7 +125,7 @@ func Trc20CallBack(token string, wg *sync.WaitGroup) { req := &request.OrderProcessingRequest{ Token: token, TradeId: tradeId, - Amount: quant, + Amount: amount, BlockTransactionId: transfer.TransactionID, } err = OrderProcessing(req)