This commit is contained in:
aozhiwei 2024-06-15 12:09:46 +08:00
parent bfea83266a
commit 6526651a65
4 changed files with 28 additions and 17 deletions

View File

@ -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")
}

View File

@ -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
}

View File

@ -1,5 +1,10 @@
package cache
type nft struct {
refreshTime int32
rawData string
}
func (this *nft) GetRawData() string {
return this.rawData
}

View File

@ -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())
}