1
This commit is contained in:
parent
fe18a0554c
commit
48fb7c3b08
@ -118,19 +118,12 @@ func (this *AssetApi) Listing(c *gin.Context) {
|
|||||||
cursor := q5.ToInt64(c.DefaultQuery("cursor", ""))
|
cursor := q5.ToInt64(c.DefaultQuery("cursor", ""))
|
||||||
netId := q5.ToInt64(c.Param("net_id"))
|
netId := q5.ToInt64(c.Param("net_id"))
|
||||||
accountAddress := strings.ToLower(c.Param("account_address"))
|
accountAddress := strings.ToLower(c.Param("account_address"))
|
||||||
filterType := q5.ToInt32(c.DefaultQuery("type", ""))
|
|
||||||
searchName := c.DefaultQuery("search_name", "")
|
searchName := c.DefaultQuery("search_name", "")
|
||||||
sql := fmt.Sprintf(`
|
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
|
SELECT * FROM t_order WHERE net_id = %d AND status = "%s"`,
|
||||||
ON A.net_id = B.net_id AND A.contract_address = B.contract_address AND A.token_id = B.token_id
|
netId,
|
||||||
WHERE A.idx > %d AND A.net_id = %d AND A.owner_address=? `,
|
jccommon.ORDER_STATUS_ACTIVE)
|
||||||
cursor, netId)
|
|
||||||
params := []string{accountAddress}
|
params := []string{accountAddress}
|
||||||
if filterType == 1 {
|
|
||||||
sql += " AND B.status = '" + jccommon.ORDER_STATUS_ACTIVE + "' "
|
|
||||||
} else if filterType == 2 {
|
|
||||||
sql += " AND (B.status IS NULL OR B.status <> '" + jccommon.ORDER_STATUS_ACTIVE + "') "
|
|
||||||
}
|
|
||||||
subFilters := []f5.DbQueryFilter{}
|
subFilters := []f5.DbQueryFilter{}
|
||||||
{
|
{
|
||||||
itemIds := map[int32]int32{}
|
itemIds := map[int32]int32{}
|
||||||
@ -138,7 +131,7 @@ WHERE A.idx > %d AND A.net_id = %d AND A.owner_address=? `,
|
|||||||
mt.Table.Item.Search(searchName, itemIds)
|
mt.Table.Item.Search(searchName, itemIds)
|
||||||
}
|
}
|
||||||
if len(itemIds) > 0 {
|
if len(itemIds) > 0 {
|
||||||
inSub := `A.item_id IN (`
|
inSub := `item_id IN (`
|
||||||
i := 0
|
i := 0
|
||||||
for key, _ := range(itemIds) {
|
for key, _ := range(itemIds) {
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
@ -178,11 +171,7 @@ WHERE A.idx > %d AND A.net_id = %d AND A.owner_address=? `,
|
|||||||
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")
|
||||||
if ds.GetByName("status") == jccommon.ORDER_STATUS_ACTIVE {
|
q5.DecodeJson(ds.GetByName("event_data"), &p.Payload)
|
||||||
p.Param1 = 1
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
q5.AppendSlice(&nfts, p)
|
q5.AppendSlice(&nfts, p)
|
||||||
})
|
})
|
||||||
GetCacheMgr().GetNfts(nfts)
|
GetCacheMgr().GetNfts(nfts)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user