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 }