update: add log-system

This commit is contained in:
lzx
2025-10-21 14:25:15 +08:00
parent 03c5430d98
commit b7c84fd101
6 changed files with 463 additions and 44 deletions

View File

@@ -341,12 +341,13 @@ func (e *ETHNode) handleUSDTEvent(vLog types.Log, ch chan any) {
d1, ok := v.(message.TopupMsg_req)
if ok && strings.ToLower(d1.Address) == toAddr {
pendingMsg := message.TopupMsg_resp{
Address: toAddr,
Status: 2, // 待确认状态
Chain: d1.Chain,
Symbol: d1.Symbol,
Amount: utils.BigIntUSDTToFloat64(transferEvent.Value),
TxHash: tx_hash,
Address: toAddr,
Status: 2, // 待确认状态
Chain: d1.Chain,
Symbol: d1.Symbol,
Amount: utils.BigIntUSDTToFloat64(transferEvent.Value),
TxHash: tx_hash,
BlockHeight: height,
}
// log.Printf("📤 发送待确认充值消息: TxHash=%s, Address=%s, Amount=%.2f",
// tx_hash, toAddr, pendingMsg.Amount)
@@ -487,12 +488,13 @@ func (e *ETHNode) confirm_usdt(tx message.Tx_msg, height uint64, ch chan any) {
// 统一转小写比较
if strings.ToLower(d1.Address) == tx.Tx.To {
result_msg = message.TopupMsg_resp{
Address: tx.Tx.To,
Status: tx.Tx.Status,
Chain: d1.Chain,
Symbol: d1.Symbol,
Amount: tx.Tx.Value,
TxHash: tx.Tx.TxHash,
Address: tx.Tx.To,
Status: tx.Tx.Status,
Chain: d1.Chain,
Symbol: d1.Symbol,
Amount: tx.Tx.Value,
TxHash: tx.Tx.TxHash,
BlockHeight: tx.Tx.Height,
}
// 充值消息不删除,可能会有多笔充值到同一地址
break
@@ -506,12 +508,15 @@ func (e *ETHNode) confirm_usdt(tx message.Tx_msg, height uint64, ch chan any) {
strings.ToLower(d2.ToAddress) == tx.Tx.To &&
d2.Amount == tx.Tx.Value {
result_msg = message.WithdrawMsg_resp{
QueueId: d2.QueueId,
Status: tx.Tx.Status,
Amount: tx.Tx.Value,
Chain: d2.Chain,
Symbol: d2.Symbol,
TxHash: tx.Tx.TxHash,
QueueId: d2.QueueId,
Status: tx.Tx.Status,
Amount: tx.Tx.Value,
Chain: d2.Chain,
Symbol: d2.Symbol,
TxHash: tx.Tx.TxHash,
FromAddress: tx.Tx.From,
ToAddress: tx.Tx.To,
BlockHeight: tx.Tx.Height,
}
matchIndex = i // 记录索引,稍后删除
break
@@ -525,13 +530,16 @@ func (e *ETHNode) confirm_usdt(tx message.Tx_msg, height uint64, ch chan any) {
strings.ToLower(d3.ToAddress) == tx.Tx.To &&
d3.Amount == tx.Tx.Value {
result_msg = message.PayMsg_resp{
QueueId: d3.QueueId,
Status: tx.Tx.Status,
Amount: tx.Tx.Value,
Chain: d3.Chain,
Symbol: d3.Symbol,
OrderId: d3.OrderId,
TxHash: tx.Tx.TxHash,
QueueId: d3.QueueId,
Status: tx.Tx.Status,
Amount: tx.Tx.Value,
Chain: d3.Chain,
Symbol: d3.Symbol,
OrderId: d3.OrderId,
TxHash: tx.Tx.TxHash,
FromAddress: tx.Tx.From,
ToAddress: tx.Tx.To,
BlockHeight: tx.Tx.Height,
}
matchIndex = i // 记录索引,稍后删除
break