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