This commit is contained in:
aozhiwei 2024-07-20 21:26:29 +08:00
parent 6947326c51
commit 3ac85e6688
2 changed files with 18 additions and 18 deletions

View File

@ -67,3 +67,12 @@ type MailEvent struct {
func (MailEvent) TableName() string { func (MailEvent) TableName() string {
return "t_event" return "t_event"
} }
type NftStacking struct {
NetId int32
ContractAddress string
TokenType int32
TokenId string
ItemId int32
Quality int32
}

View File

@ -14,18 +14,9 @@ type contribution struct {
lockMetas []*mt.Contract lockMetas []*mt.Contract
} }
type nftStacking struct {
netId int32
contractAddress string
tokenType int32
tokenId string
itemId int32
quality int32
}
type accountStacking struct { type accountStacking struct {
accountAddress string accountAddress string
nfts []*nftStacking nfts []*jccommon.NftStacking
} }
func (this* contribution) init() { func (this* contribution) init() {
@ -117,19 +108,19 @@ func (this* contribution) loadFromDb(addressHash *q5.ConcurrentMap[string, *acco
if accountAddress == "" { if accountAddress == "" {
return true return true
} }
p := new(nftStacking) p := new(jccommon.NftStacking)
p.netId = q5.ToInt32(ds.GetByName("net_id")) p.NetId = q5.ToInt32(ds.GetByName("net_id"))
p.contractAddress = ds.GetByName("contract_address") p.ContractAddress = ds.GetByName("contract_address")
p.tokenType = q5.ToInt32(ds.GetByName("token_type")) p.TokenType = q5.ToInt32(ds.GetByName("token_type"))
p.tokenId = ds.GetByName("token_id") p.TokenId = ds.GetByName("token_id")
p.itemId = q5.ToInt32(ds.GetByName("item_id")) p.ItemId = q5.ToInt32(ds.GetByName("item_id"))
p.quality = q5.ToInt32(ds.GetByName("quality")) p.Quality = q5.ToInt32(ds.GetByName("quality"))
if a, ok := addressHash.Load(accountAddress); ok { if a, ok := addressHash.Load(accountAddress); ok {
q5.AppendSlice(&(*a).nfts, p) q5.AppendSlice(&(*a).nfts, p)
} else { } else {
a := new(accountStacking) a := new(accountStacking)
a.accountAddress = accountAddress a.accountAddress = accountAddress
a.nfts = []*nftStacking{} a.nfts = []*jccommon.NftStacking{}
q5.AppendSlice(&a.nfts, p) q5.AppendSlice(&a.nfts, p)
} }
return true return true