1
This commit is contained in:
parent
3ffef7cd40
commit
919893b557
@ -7,6 +7,7 @@ import (
|
||||
"main/common"
|
||||
"jccommon"
|
||||
"fmt"
|
||||
"mt"
|
||||
"strings"
|
||||
. "main/global"
|
||||
"github.com/gin-gonic/gin"
|
||||
@ -25,6 +26,7 @@ func (this *AssetApi) AccountAsset(c *gin.Context) {
|
||||
netId := q5.ToInt64(c.Param("net_id"))
|
||||
accountAddress := strings.ToLower(c.Param("account_address"))
|
||||
filterType := q5.ToInt32(c.DefaultQuery("type", ""))
|
||||
searchName := c.DefaultQuery("search_name", "")
|
||||
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
|
||||
ON A.net_id = B.net_id AND A.contract_address = B.contract_address AND A.token_id = B.token_id
|
||||
@ -32,9 +34,30 @@ WHERE A.idx > %d AND A.net_id = %d AND A.owner_address=? `,
|
||||
cursor, netId)
|
||||
params := []string{accountAddress}
|
||||
if filterType == 1 {
|
||||
sql += "B.status = '" + jccommon.ORDER_STATUS_ACTIVE + "'"
|
||||
sql += " AND B.status = '" + jccommon.ORDER_STATUS_ACTIVE + "' "
|
||||
} else if filterType == 2 {
|
||||
sql += "B.status <> '" + jccommon.ORDER_STATUS_ACTIVE + "'"
|
||||
sql += " AND B.status <> '" + jccommon.ORDER_STATUS_ACTIVE + "' "
|
||||
}
|
||||
subFilters := []f5.DbQueryFilter{}
|
||||
{
|
||||
itemIds := map[int32]int32{}
|
||||
if searchName != "" {
|
||||
mt.Table.Item.Search(searchName, itemIds)
|
||||
}
|
||||
if len(itemIds) > 0 {
|
||||
inSub := `A.item_id IN (`
|
||||
i := 0
|
||||
for key, _ := range(itemIds) {
|
||||
if i == 0 {
|
||||
inSub += q5.ToString(key)
|
||||
} else {
|
||||
inSub += "," + q5.ToString(key)
|
||||
}
|
||||
i += 1
|
||||
}
|
||||
inSub += ")"
|
||||
q5.AppendSlice(&subFilters, f5.GetDbFilter().Custom(inSub).And())
|
||||
}
|
||||
}
|
||||
orderBy := ""
|
||||
rspObj := struct {
|
||||
@ -52,8 +75,7 @@ WHERE A.idx > %d AND A.net_id = %d AND A.owner_address=? `,
|
||||
cursor,
|
||||
sql,
|
||||
params,
|
||||
f5.GetDbFilter().Comp(
|
||||
),
|
||||
f5.GetDbFilter().Comp(subFilters...),
|
||||
orderBy,
|
||||
func (err error, pagination *f5.StreamPagination) {
|
||||
rspObj.Page.FillPage(pagination)
|
||||
|
Loading…
x
Reference in New Issue
Block a user