This commit is contained in:
aozhiwei 2024-06-23 12:46:16 +08:00
parent a06f8cf8d5
commit 9279e85de0

View File

@ -10,12 +10,14 @@ import (
"main/constant"
)
type handleFunc func(int64, int32, string, string, string, string) bool
type specTransfer721 struct {
handleHash *q5.ConcurrentMap[string, func(*f5.DataSet) bool]
handleHash *q5.ConcurrentMap[string, handleFunc]
}
func (this* specTransfer721) init() {
this.handleHash = new(q5.ConcurrentMap[string, func(*f5.DataSet)bool])
this.handleHash = new(q5.ConcurrentMap[string, handleFunc])
this.handleHash.Store(jccommon.CONTRACT_NAME_CFHero, this.procHero)
this.handleHash.Store(jccommon.CONTRACT_NAME_GoldBrick, this.procGoldBullion)
go this.process()
@ -46,22 +48,28 @@ SELECT * FROM t_721nft_spec_transfer WHERE idx > %d AND status = 0 AND createtim
return time.Second * 60 * 1
},
func (ds *f5.DataSet) bool {
idx := q5.ToInt64(ds.GetByName("idx"))
netId := q5.ToInt32(ds.GetByName("net_id"))
contractAddress := ds.GetByName("contract_address")
tokenId := ds.GetByName("token_id")
fromAddress := ds.GetByName("from_address")
toAddress := ds.GetByName("toaddress")
contractMeta := mt.Table.Contract.GetByNetIdAddress(netId, contractAddress)
if contractMeta != nil {
if p, ok := this.handleHash.Load(contractMeta.GetName()); ok {
return (*p)(ds)
return (*p)(idx, netId, contractAddress, tokenId, fromAddress, toAddress)
}
}
return true
})
}
func (this* specTransfer721) procHero(ds *f5.DataSet) bool {
func (this* specTransfer721) procHero(dbIdx int64, netId int32, contractAddress string, tokenId string,
from string, to string) bool {
return true
}
func (this* specTransfer721) procGoldBullion(ds *f5.DataSet) bool {
func (this* specTransfer721) procGoldBullion(dbIdx int64, netId int32, contractAddress string, tokenId string,
from string, to string) bool {
return true
}