mirror of
https://github.com/GMWalletApp/epusdt.git
synced 2026-07-07 18:26:16 +00:00
修复整数没有补位0导致无法匹配交易
This commit is contained in:
@@ -2,6 +2,7 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"github.com/assimon/luuu/model/data"
|
"github.com/assimon/luuu/model/data"
|
||||||
"github.com/assimon/luuu/model/request"
|
"github.com/assimon/luuu/model/request"
|
||||||
"github.com/assimon/luuu/util/http_client"
|
"github.com/assimon/luuu/util/http_client"
|
||||||
@@ -97,8 +98,9 @@ func Trc20CallBack(token string, wg *sync.WaitGroup) {
|
|||||||
}
|
}
|
||||||
x, _ := decimal.NewFromString(transfer.Quant)
|
x, _ := decimal.NewFromString(transfer.Quant)
|
||||||
y, _ := decimal.NewFromString("1000000")
|
y, _ := decimal.NewFromString("1000000")
|
||||||
quant := x.Div(y).String()
|
quant := x.Div(y).InexactFloat64()
|
||||||
result, err := data.GetExpirationTimeByAmount(ctx, token, quant)
|
amount := fmt.Sprintf("%.4f", quant)
|
||||||
|
result, err := data.GetExpirationTimeByAmount(ctx, token, amount)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@@ -107,12 +109,12 @@ func Trc20CallBack(token string, wg *sync.WaitGroup) {
|
|||||||
// 但是过期了
|
// 但是过期了
|
||||||
if expTime < nowTime {
|
if expTime < nowTime {
|
||||||
// 删掉过期
|
// 删掉过期
|
||||||
_ = data.ClearPayCache(token, quant)
|
_ = data.ClearPayCache(token, amount)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 该钱包下有无匹配金额订单
|
// 该钱包下有无匹配金额订单
|
||||||
tradeId, err := data.GetTradeIdByAmount(ctx, token, quant)
|
tradeId, err := data.GetTradeIdByAmount(ctx, token, amount)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@@ -123,7 +125,7 @@ func Trc20CallBack(token string, wg *sync.WaitGroup) {
|
|||||||
req := &request.OrderProcessingRequest{
|
req := &request.OrderProcessingRequest{
|
||||||
Token: token,
|
Token: token,
|
||||||
TradeId: tradeId,
|
TradeId: tradeId,
|
||||||
Amount: quant,
|
Amount: amount,
|
||||||
BlockTransactionId: transfer.TransactionID,
|
BlockTransactionId: transfer.TransactionID,
|
||||||
}
|
}
|
||||||
err = OrderProcessing(req)
|
err = OrderProcessing(req)
|
||||||
|
|||||||
Reference in New Issue
Block a user