From 7ee0e131a0f98d626b2751446e95524bb6b57e6a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sun, 16 Jun 2024 18:36:45 +0800 Subject: [PATCH] 1 --- server/marketserver/cache/cachemgr.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/marketserver/cache/cachemgr.go b/server/marketserver/cache/cachemgr.go index 1aeedcd8..fb52a3bc 100644 --- a/server/marketserver/cache/cachemgr.go +++ b/server/marketserver/cache/cachemgr.go @@ -65,11 +65,9 @@ func (this *cacheMgr) internalGetNft(dto *common.NftDto) { }, func (rsp f5.HttpCliResponse) { if rsp.GetErr() == nil { - p := new(nft) jsonRsp := map[string]interface{}{} q5.DecodeJson(rsp.GetRawData(), &jsonRsp) - p.jsonData = jsonRsp - dto.NftCache = p + dto.NftCache = this.addNft(dto.NetId, dto.ContractAddress, dto.TokenId, jsonRsp) } }) } @@ -146,7 +144,7 @@ func (this *cacheMgr) batchGetNfts(nfts []*common.NftDto) { } func (this *cacheMgr) addNft(netId int32, contractAddress string, tokenId string, - data map[string]interface{}) { + data map[string]interface{}) *nft { dto := new(common.NftDto) dto.NetId = netId dto.ContractAddress = contractAddress @@ -154,4 +152,5 @@ func (this *cacheMgr) addNft(netId int32, contractAddress string, tokenId string p := newNft() p.jsonData = data this.nftHash.Store(dto.GetKey(), p) + return p }