1
This commit is contained in:
parent
f75495f4fd
commit
163f1e0f65
@ -173,22 +173,23 @@ func (this *MarketApi) TransactionHistory(c *gin.Context) {
|
|||||||
pageSize := q5.ToInt32(c.DefaultQuery("page_size", ""))
|
pageSize := q5.ToInt32(c.DefaultQuery("page_size", ""))
|
||||||
if pageSize < 0 {
|
if pageSize < 0 {
|
||||||
pageSize = 1
|
pageSize = 1
|
||||||
} else if pageSize > 100 {
|
} else if pageSize > 20 {
|
||||||
pageSize = 100
|
pageSize = 20
|
||||||
}
|
}
|
||||||
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", ""))
|
filterType := q5.ToInt32(c.DefaultQuery("type", ""))
|
||||||
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_sale WHERE idx > %d AND net_id = %d `,
|
||||||
ON A.net_id = B.net_id AND A.contract_address = B.contract_address AND A.token_id = B.token_id
|
|
||||||
WHERE A.idx > %d AND A.net_id = %d AND A.owner_address=? `,
|
|
||||||
cursor, netId)
|
cursor, netId)
|
||||||
if filterType == 1 {
|
subFilters := []f5.DbQueryFilter{}
|
||||||
sql += "B.status = '" + constant.ORDER_STATUS_ACTIVE + "'"
|
{
|
||||||
} else if filterType == 2 {
|
if filterType == 1 {
|
||||||
sql += "B.status <> '" + constant.ORDER_STATUS_ACTIVE + "'"
|
q5.AppendSlice(&subFilters, f5.GetDbFilter().EQ("buyer", accountAddress).And())
|
||||||
|
} else if filterType == 2 {
|
||||||
|
q5.AppendSlice(&subFilters, f5.GetDbFilter().EQ("seller", accountAddress).And())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rspObj := struct {
|
rspObj := struct {
|
||||||
ErrCode int32 `json:"errcode"`
|
ErrCode int32 `json:"errcode"`
|
||||||
@ -207,8 +208,7 @@ WHERE A.idx > %d AND A.net_id = %d AND A.owner_address=? `,
|
|||||||
[]string{
|
[]string{
|
||||||
accountAddress,
|
accountAddress,
|
||||||
},
|
},
|
||||||
f5.GetDbFilter().Comp(
|
f5.GetDbFilter().Comp(subFilters...),
|
||||||
),
|
|
||||||
"",
|
"",
|
||||||
func (err error, pagination *f5.StreamPagination) {
|
func (err error, pagination *f5.StreamPagination) {
|
||||||
rspObj.Page.FillPage(pagination)
|
rspObj.Page.FillPage(pagination)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user