diff --git a/server/marketserver/api/v1/market/market.go b/server/marketserver/api/v1/market/market.go index a3e4d8f8..33e14863 100644 --- a/server/marketserver/api/v1/market/market.go +++ b/server/marketserver/api/v1/market/market.go @@ -173,22 +173,23 @@ func (this *MarketApi) TransactionHistory(c *gin.Context) { pageSize := q5.ToInt32(c.DefaultQuery("page_size", "")) if pageSize < 0 { pageSize = 1 - } else if pageSize > 100 { - pageSize = 100 + } else if pageSize > 20 { + pageSize = 20 } cursor := q5.ToInt64(c.DefaultQuery("cursor", "")) netId := q5.ToInt64(c.Param("net_id")) accountAddress := strings.ToLower(c.Param("account_address")) filterType := q5.ToInt32(c.DefaultQuery("type", "")) 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 -WHERE A.idx > %d AND A.net_id = %d AND A.owner_address=? `, +SELECT * FROM t_sale WHERE idx > %d AND net_id = %d `, cursor, netId) - if filterType == 1 { - sql += "B.status = '" + constant.ORDER_STATUS_ACTIVE + "'" - } else if filterType == 2 { - sql += "B.status <> '" + constant.ORDER_STATUS_ACTIVE + "'" + subFilters := []f5.DbQueryFilter{} + { + if filterType == 1 { + q5.AppendSlice(&subFilters, f5.GetDbFilter().EQ("buyer", accountAddress).And()) + } else if filterType == 2 { + q5.AppendSlice(&subFilters, f5.GetDbFilter().EQ("seller", accountAddress).And()) + } } rspObj := struct { ErrCode int32 `json:"errcode"` @@ -207,8 +208,7 @@ WHERE A.idx > %d AND A.net_id = %d AND A.owner_address=? `, []string{ accountAddress, }, - f5.GetDbFilter().Comp( - ), + f5.GetDbFilter().Comp(subFilters...), "", func (err error, pagination *f5.StreamPagination) { rspObj.Page.FillPage(pagination)