diff --git a/server/marketserver/api/v1/asset/asset.go b/server/marketserver/api/v1/asset/asset.go index f2e9d7f9..35a2c901 100644 --- a/server/marketserver/api/v1/asset/asset.go +++ b/server/marketserver/api/v1/asset/asset.go @@ -4,6 +4,7 @@ import ( "q5" "f5" "main/constant" + "main/common" "fmt" "strings" "github.com/gin-gonic/gin" @@ -26,7 +27,6 @@ func (this *AssetApi) AccountAsset(c *gin.Context) { cursor := q5.ToInt64(c.DefaultQuery("cursor", "")) netId := q5.ToInt64(c.Param("net_id")) accountAddress := strings.ToLower(c.Param("account_address")) - //searchName := c.DefaultQuery("search_name", "") filterType := q5.ToInt32(c.DefaultQuery("type", "")) sql := fmt.Sprintf(` SELECT A.idx, A.net_id, A.token_type, A.token_id, A.contract_address, B.status FROM t_nft A LEFT JOIN t_order B @@ -38,13 +38,7 @@ WHERE A.idx > %d AND A.net_id = %d AND A.owner_address=? LIMIT %d`, } else if filterType == 2 { sql += "B.status <> '" + constant.ORDER_STATUS_ACTIVE + "'" } - nfts := []struct{ - idx int64 - netId int32 - tokenType int32 - tokenId string - contractAddress string - }{} + nfts := []common.NftDto{} f5.GetGoStyleDb().StreamPageQuery( constant.BCNFT_DB, pageSize, @@ -60,13 +54,10 @@ WHERE A.idx > %d AND A.net_id = %d AND A.owner_address=? LIMIT %d`, }, func (ds *f5.DataSet) { - var p = q5.NewSliceElement(&nfts) - p.idx = q5.ToInt64(ds.GetByName("idx")) - p.netId = q5.ToInt32(ds.GetByName("net_id")) - p.tokenType = q5.ToInt32(ds.GetByName("token_type")) - p.tokenId = ds.GetByName("token_id") - p.contractAddress = ds.GetByName("contract_address") - f5.GetSysLog().Info("idx:%s", p.idx) + p := q5.NewSliceElement(&nfts) + p.NetId = q5.ToInt32(ds.GetByName("net_id")) + p.ContractAddress = ds.GetByName("contract_address") + p.TokenId = ds.GetByName("token_id") }) f5.GetSysLog().Info("dafdf") } diff --git a/server/marketserver/cache/cachemgr.go b/server/marketserver/cache/cachemgr.go index 2efb7a9a..685e63eb 100644 --- a/server/marketserver/cache/cachemgr.go +++ b/server/marketserver/cache/cachemgr.go @@ -5,7 +5,7 @@ import ( ) type cacheMgr struct { - nftHash sync.Map + nftHash sync.Map //net_id contract_address token_id -> nft } func (this *cacheMgr) Init() { @@ -15,3 +15,7 @@ func (this *cacheMgr) Init() { func (this *cacheMgr) UnInit() { } + +func (this *cacheMgr) internalGetNft(netId int32, contractAddress string, tokenId string) *nft { + return nil +} diff --git a/server/marketserver/cache/nft.go b/server/marketserver/cache/nft.go index dcaa10ba..017da6fc 100644 --- a/server/marketserver/cache/nft.go +++ b/server/marketserver/cache/nft.go @@ -1,5 +1,10 @@ package cache type nft struct { - + refreshTime int32 + rawData string +} + +func (this *nft) GetRawData() string { + return this.rawData } diff --git a/server/marketserver/common/types.go b/server/marketserver/common/types.go index a1c2bb96..fd539e50 100644 --- a/server/marketserver/common/types.go +++ b/server/marketserver/common/types.go @@ -34,6 +34,17 @@ type OrderUpdatedEvent struct { } `json:"data"` } +type NftCache interface { + +} + +type NftDto struct { + NetId int32 + ContractAddress string + TokenId string + NftCache NftCache +} + type App interface { Run(func(), func()) }