diff --git a/server/jccommon/types.go b/server/jccommon/types.go index 15662258..f1cee747 100644 --- a/server/jccommon/types.go +++ b/server/jccommon/types.go @@ -67,3 +67,12 @@ type MailEvent struct { func (MailEvent) TableName() string { return "t_event" } + +type NftStacking struct { + NetId int32 + ContractAddress string + TokenType int32 + TokenId string + ItemId int32 + Quality int32 +} diff --git a/server/light_backtask/task/contribution.go b/server/light_backtask/task/contribution.go index f50e5b0b..9467a169 100644 --- a/server/light_backtask/task/contribution.go +++ b/server/light_backtask/task/contribution.go @@ -14,18 +14,9 @@ type contribution struct { lockMetas []*mt.Contract } -type nftStacking struct { - netId int32 - contractAddress string - tokenType int32 - tokenId string - itemId int32 - quality int32 -} - type accountStacking struct { accountAddress string - nfts []*nftStacking + nfts []*jccommon.NftStacking } func (this* contribution) init() { @@ -117,19 +108,19 @@ func (this* contribution) loadFromDb(addressHash *q5.ConcurrentMap[string, *acco if accountAddress == "" { return true } - p := new(nftStacking) - p.netId = q5.ToInt32(ds.GetByName("net_id")) - p.contractAddress = ds.GetByName("contract_address") - p.tokenType = q5.ToInt32(ds.GetByName("token_type")) - p.tokenId = ds.GetByName("token_id") - p.itemId = q5.ToInt32(ds.GetByName("item_id")) - p.quality = q5.ToInt32(ds.GetByName("quality")) + p := new(jccommon.NftStacking) + p.NetId = q5.ToInt32(ds.GetByName("net_id")) + p.ContractAddress = ds.GetByName("contract_address") + p.TokenType = q5.ToInt32(ds.GetByName("token_type")) + p.TokenId = ds.GetByName("token_id") + p.ItemId = q5.ToInt32(ds.GetByName("item_id")) + p.Quality = q5.ToInt32(ds.GetByName("quality")) if a, ok := addressHash.Load(accountAddress); ok { q5.AppendSlice(&(*a).nfts, p) } else { a := new(accountStacking) a.accountAddress = accountAddress - a.nfts = []*nftStacking{} + a.nfts = []*jccommon.NftStacking{} q5.AppendSlice(&a.nfts, p) } return true