This commit is contained in:
aozhiwei 2024-06-23 12:35:04 +08:00
parent 974125e220
commit a06f8cf8d5

View File

@ -11,10 +11,13 @@ import (
)
type specTransfer721 struct {
handleHash *q5.ConcurrentMap[string, func(*f5.DataSet) bool]
}
func (this* specTransfer721) init() {
this.handleHash = new(q5.ConcurrentMap[string, func(*f5.DataSet)bool])
this.handleHash.Store(jccommon.CONTRACT_NAME_CFHero, this.procHero)
this.handleHash.Store(jccommon.CONTRACT_NAME_GoldBrick, this.procGoldBullion)
go this.process()
}
@ -42,21 +45,23 @@ SELECT * FROM t_721nft_spec_transfer WHERE idx > %d AND status = 0 AND createtim
func () time.Duration {
return time.Second * 60 * 1
},
this.process1)
func (ds *f5.DataSet) bool {
netId := q5.ToInt32(ds.GetByName("net_id"))
contractAddress := ds.GetByName("contract_address")
contractMeta := mt.Table.Contract.GetByNetIdAddress(netId, contractAddress)
if contractMeta != nil {
if p, ok := this.handleHash.Load(contractMeta.GetName()); ok {
return (*p)(ds)
}
}
return true
})
}
func (this* specTransfer721) process1(ds *f5.DataSet) bool {
netId := q5.ToInt32(ds.GetByName("net_id"))
contractAddress := ds.GetByName("contract_address")
//tokenId := ds.GetByName("token_id")
contractMeta := mt.Table.Contract.GetByNetIdAddress(netId, contractAddress)
if contractMeta != nil {
switch contractMeta.GetName() {
case jccommon.CONTRACT_NAME_CFHero: {
}
case jccommon.CONTRACT_NAME_GoldBrick: {
}
}
}
func (this* specTransfer721) procHero(ds *f5.DataSet) bool {
return true
}
func (this* specTransfer721) procGoldBullion(ds *f5.DataSet) bool {
return true
}