merge transactions and update

This commit is contained in:
lzx
2025-10-31 13:46:58 +08:00
parent 056bc05b75
commit 8d7da5d345
12 changed files with 1154 additions and 975 deletions

View File

@@ -60,17 +60,20 @@ type DbConfig struct {
// =============================== type0 ===============================
// 接收的充值消息
type TopupMsg_req struct {
QueueId string `json:"queue_id"`
Chain string `json:"chain"` // 链名称
Symbol string `json:"symbol"` // 币种
Address string `json:"address"`
Timestamp uint64 `json:"timestamp"`
Sign string `json:"sign"`
Status int `json:"status,omitempty"`
}
// 返回充值结果消息
type TopupMsg_resp struct {
QueueId string `json:"queue_id"`
Address string `json:"address"`
Status int `json:"status"`
Status int `json:"status"` // 0失败1成功2待定3sign校验失败
Chain string `json:"chain"` // 链名称
Symbol string `json:"symbol"` // 币种
Amount float64 `json:"amount"`
@@ -87,8 +90,10 @@ type WithdrawMsg_req struct {
Amount float64 `json:"amount"`
Chain string `json:"chain"` // 链名称
Symbol string `json:"symbol"` // 币种
TxHash string `json:"tx_hash,omitempty"`
Timestamp uint64 `json:"timestamp"`
Sign string `json:"sign"`
Status int `json:"status,omitempty"`
}
// 返回提现结果消息
@@ -96,7 +101,7 @@ type WithdrawMsg_resp struct {
QueueId string `json:"queue_id"`
Chain string `json:"chain"` // 链名称
Symbol string `json:"symbol"` // 币种
Status int `json:"status"`
Status int `json:"status"` // 0失败1成功3sign校验失败
Amount float64 `json:"amount"`
TxHash string `json:"tx_hash"`
FromAddress string `json:"from_address"` // 来源地址
@@ -105,36 +110,74 @@ type WithdrawMsg_resp struct {
}
// =============================== type2 ===============================
// 接收到的支付消息
type PayMsg_req struct {
QueueId string `json:"queue_id"`
FromAddress string `json:"from_address"` // 我们提供的地址
ToAddress string `json:"to_address"` // 卖家地址
Amount float64 `json:"amount"`
Chain string `json:"chain"` // 链名称
Symbol string `json:"symbol"` // 币种
OrderId string `json:"order_id"` // 订单号
Timestamp uint64 `json:"timestamp"`
Sign string `json:"sign"`
QueueId string `json:"queue_id"`
FromAddress string `json:"from_address"`
Chain string `json:"chain"`
Symbol string `json:"symbol"`
TotalAmount float64 `json:"total_amount"`
Timestamp uint64 `json:"timestamp"`
Sign string `json:"sign"`
Trasnactions map[string]*PayData_req `json:"transactions"` // {"to_address": PayData_req{}, ...}
}
type PayData_req struct {
OrderId string `json:"order_id"`
ToAddress string `json:"to_address"`
TxHash string `json:"tx_hash,omitempty"`
Amount float64 `json:"amount"`
Status int `json:"status,omitempty"`
}
// 返回支付结果消息
type PayMsg_resp struct {
QueueId string `json:"queue_id"`
Status int `json:"status"`
Amount float64 `json:"amount"`
Chain string `json:"chain"` // 链名称
Symbol string `json:"symbol"` // 币种
OrderId string `json:"order_id"` // 订单号
TxHash string `json:"tx_hash"`
FromAddress string `json:"from_address"` // 来源地址
ToAddress string `json:"to_address"` // 目标地址
BlockHeight uint64 `json:"block_height"` // 区块高度
QueueId string `json:"queue_id"`
FromAddress string `json:"from_address"`
PayStatus int `json:"pay_status"` // 1至少有一笔转账成功3sign校验失败4钱包余额不足
Transactions map[string]*PayData_resp `json:"transactions"` // {"to_address": PayData_resp{}, ...}
}
type PayData_resp struct {
OrderId string `json:"order_id"`
FromAddress string `json:"from_address"`
ToAddress string `json:"to_address"`
Chain string `json:"chain"`
Symbol string `json:"symbol"`
Amount float64 `json:"amount"`
TxHash string `json:"tx_hash,omitempty"`
BlockHeight uint64 `json:"block_height,omitempty"`
Status int `json:"status"` // 0失败1成功
}
// 接收到的支付消息
// type PayMsg_req struct {
// QueueId string `json:"queue_id"`
// FromAddress string `json:"from_address"` // 我们提供的地址
// ToAddress string `json:"to_address"` // 卖家地址
// Amount float64 `json:"amount"`
// Chain string `json:"chain"` // 链名称
// Symbol string `json:"symbol"` // 币种
// OrderId string `json:"order_id"` // 订单号
// Timestamp uint64 `json:"timestamp"`
// Sign string `json:"sign"`
// Transactions map[string]Transaction `json:"tx"`
// }
// 返回支付结果消息
// type PayMsg_resp struct {
// QueueId string `json:"queue_id"`
// Status int `json:"status"`
// Amount float64 `json:"amount"`
// Chain string `json:"chain"` // 链名称
// Symbol string `json:"symbol"` // 币种
// OrderId string `json:"order_id"` // 订单号
// TxHash string `json:"tx_hash"`
// FromAddress string `json:"from_address"` // 来源地址
// ToAddress string `json:"to_address"` // 目标地址
// BlockHeight uint64 `json:"block_height"` // 区块高度
// }
// =============================== type3 ===============================
// 接收到的删除监听地址消息
type RemoveListenMsg_req struct {
QueueId string `json:"queue_id"`
MsgType int `json:"msg_type"`
Chain string `json:"chain"`
Symbol string `json:"symbol"`
@@ -145,6 +188,7 @@ type RemoveListenMsg_req struct {
// 返回收到的删除监听地址消息
type RemoveListenMsg_resp struct {
QueueId string `json:"queue_id"`
MsgType int `json:"msg_type"`
Chain string `json:"chain"`
Symbol string `json:"symbol"`
@@ -167,3 +211,13 @@ type Tx struct {
Value float64 `json:"value"` // 数量,单位是币
Status int `json:"status"` // 交易状态1成功0失败, 2待确认
}
type Transaction struct {
From string `json:"from"` // 充值/提现/支付的来源地址
To string `json:"to"` // 充值/提现/支付的目标地址
Height uint64 `json:"height"` // 区块高度
TxHash string `json:"tx_hash"` // 交易哈希
Symbol string `json:"symbol"` // 币种
Value float64 `json:"value"` // 数量,单位是币
Status int `json:"status"` // 交易状态1成功0失败, 2待确认
}