This commit is contained in:
aozhiwei 2024-06-19 19:04:21 +08:00
parent cd31ec576c
commit 7562a8b0d9
4 changed files with 49 additions and 6 deletions

View File

@ -60,6 +60,7 @@ SELECT * FROM t_order A WHERE idx > %d AND net_id = %d
} }
orderBy := "" orderBy := ""
/*
{ {
for _, val := range reqJson.Sort.Fields { for _, val := range reqJson.Sort.Fields {
if val.Name == "price" && orderBy == "" { if val.Name == "price" && orderBy == "" {
@ -71,7 +72,7 @@ SELECT * FROM t_order A WHERE idx > %d AND net_id = %d
} }
} }
} }
} }*/
subFilters := []f5.DbQueryFilter{} subFilters := []f5.DbQueryFilter{}
{ {
priceMin := q5.SafeToString(reqJson.Filter.PriceMin) priceMin := q5.SafeToString(reqJson.Filter.PriceMin)
@ -131,10 +132,12 @@ SELECT * FROM t_order A WHERE idx > %d AND net_id = %d
ErrCode int32 `json:"errcode"` ErrCode int32 `json:"errcode"`
ErrMsg string `json:"errmsg"` ErrMsg string `json:"errmsg"`
Page common.StreamPagination `json:"page"` Page common.StreamPagination `json:"page"`
Rows []interface{} `json:"rows"` Rows []struct{
}{ Event interface{} `json:"event"`
Rows : []interface{}{}, Nft interface{} `json:"nft"`
} } `json:"rows"`
}{}
q5.NewSlice(&rspObj.Rows, 0, 10)
nfts := []*common.NftDto{} nfts := []*common.NftDto{}
f5.GetGoStyleDb().StreamPageQuery( f5.GetGoStyleDb().StreamPageQuery(
constant.BCNFT_DB, constant.BCNFT_DB,
@ -153,12 +156,16 @@ SELECT * FROM t_order A WHERE idx > %d AND net_id = %d
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.TokenId = ds.GetByName("token_id") p.TokenId = ds.GetByName("token_id")
p.Payload = map[string]interface{}{}
q5.DecodeJson(ds.GetByName("event_data"), &p.Payload)
q5.AppendSlice(&nfts, p) q5.AppendSlice(&nfts, p)
}) })
GetCacheMgr().GetNfts(nfts) GetCacheMgr().GetNfts(nfts)
{ {
for _, val := range nfts { for _, val := range nfts {
q5.AppendSlice(&rspObj.Rows, val.NftCache.GetJsonData()) p := q5.NewSliceElement(&rspObj.Rows)
p.Event = val.Payload
p.Nft = val.NftCache.GetJsonData()
} }
} }
c.JSON(200, rspObj) c.JSON(200, rspObj)

View File

@ -71,6 +71,7 @@ type NftDto struct {
ContractAddress string ContractAddress string
TokenId string TokenId string
NftCache NftCache NftCache NftCache
Payload interface{}
} }
type App interface { type App interface {

View File

@ -0,0 +1,31 @@
package mt
import (
)
type Contract struct {
}
type ContractTable struct {
}
func (this *ContractTable) IsNoLoad() bool {
return false
}
func (this *ContractTable) Load() {
}
func (this *ContractTable) PreInit1() {
}
func (this *ContractTable) ElementsInit(int) {
}
func (this *ContractTable) PostInit1() {
}

View File

@ -9,6 +9,7 @@ type table struct {
NftDb *NftDbTable NftDb *NftDbTable
Config *ConfigTable Config *ConfigTable
NftHomeMeta *NftHomeMetaTable NftHomeMeta *NftHomeMetaTable
Contract *ContractTable
} }
var Table = f5.New(func(this *table) { var Table = f5.New(func(this *table) {
@ -31,4 +32,7 @@ var Table = f5.New(func(this *table) {
this.FileName = "../config/nft_home_meta.json" this.FileName = "../config/nft_home_meta.json"
this.PrimKey = "name" this.PrimKey = "name"
}) })
this.Contract = new(ContractTable)
}) })