1
This commit is contained in:
parent
4dfdb049c6
commit
fdec315fba
@ -44,7 +44,9 @@ WHERE A.idx > %d AND A.net_id = %d AND A.owner_address=? LIMIT %d`,
|
||||
ErrMsg string `json:"errmsg"`
|
||||
Page common.StreamPagination `json:"page"`
|
||||
Rows []interface{} `json:"rows"`
|
||||
}{}
|
||||
}{
|
||||
Rows : []interface{}{},
|
||||
}
|
||||
nfts := []*common.NftDto{}
|
||||
f5.GetGoStyleDb().StreamPageQuery(
|
||||
constant.BCNFT_DB,
|
||||
@ -68,5 +70,10 @@ WHERE A.idx > %d AND A.net_id = %d AND A.owner_address=? LIMIT %d`,
|
||||
q5.AppendSlice(&nfts, p)
|
||||
})
|
||||
GetCacheMgr().GetNfts(nfts)
|
||||
{
|
||||
for _, val := range nfts {
|
||||
q5.AppendSlice(&rspObj.Rows, val.NftCache.GetJsonData())
|
||||
}
|
||||
}
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
14
server/marketserver/cache/cachemgr.go
vendored
14
server/marketserver/cache/cachemgr.go
vendored
@ -1,6 +1,7 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"q5"
|
||||
"f5"
|
||||
"mt"
|
||||
"sync"
|
||||
@ -41,11 +42,18 @@ func (this *cacheMgr) internalGetNft(dto *common.NftDto) {
|
||||
map[string]string{
|
||||
"c": "OutAppNft",
|
||||
"a": "nftDetail",
|
||||
"nft_type": "gold_bullion",
|
||||
//"net_id": netId,
|
||||
//"token_id": tokenId,
|
||||
"nft_type": "hero",
|
||||
"net_id": q5.ToString(dto.NetId),
|
||||
"token_id": dto.TokenId,
|
||||
},
|
||||
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
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
5
server/marketserver/cache/nft.go
vendored
5
server/marketserver/cache/nft.go
vendored
@ -3,8 +3,13 @@ package cache
|
||||
type nft struct {
|
||||
refreshTime int32
|
||||
rawData string
|
||||
jsonData interface{}
|
||||
}
|
||||
|
||||
func (this *nft) GetRawData() string {
|
||||
return this.rawData
|
||||
}
|
||||
|
||||
func (this *nft) GetJsonData() interface{} {
|
||||
return this.jsonData
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ type StreamPagination struct {
|
||||
|
||||
type NftCache interface {
|
||||
GetRawData() string
|
||||
GetJsonData() interface{}
|
||||
}
|
||||
|
||||
type NftDto struct {
|
||||
@ -69,7 +70,11 @@ type CacheMgr interface{
|
||||
|
||||
|
||||
func (this* StreamPagination) FillPage(page *f5.StreamPagination) {
|
||||
this.NextCursor = q5.ToString(page.NextCursor)
|
||||
this.PreviousCursor = q5.ToString(page.PreviousCursor)
|
||||
if page.NextCursor != 0 {
|
||||
this.NextCursor = q5.ToString(page.NextCursor)
|
||||
}
|
||||
if page.PreviousCursor != 0 {
|
||||
this.PreviousCursor = q5.ToString(page.PreviousCursor)
|
||||
}
|
||||
this.Remaining = page.Remaining
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user