This commit is contained in:
aozhiwei 2024-06-16 10:33:54 +08:00
parent fdec315fba
commit 83eaf03d75
2 changed files with 26 additions and 18 deletions

View File

@ -5,6 +5,8 @@ import (
"f5" "f5"
"mt" "mt"
"main/constant" "main/constant"
"main/common"
. "main/global"
"fmt" "fmt"
//"strings" //"strings"
"net/http" "net/http"
@ -54,7 +56,7 @@ func (this *MarketApi) ProductList(c *gin.Context) {
sql := fmt.Sprintf(` sql := fmt.Sprintf(`
SELECT * FROM t_order A WHERE idx > %d AND net_id = %d AND status="%s" SELECT * FROM t_order A WHERE idx > %d AND net_id = %d AND status="%s"
`, `,
cursor, netId, constant.ORDER_STATUS_ACTIVE, pageSize + 1) cursor, netId, constant.ORDER_STATUS_ACTIVE)
orderBy := "" orderBy := ""
{ {
@ -124,13 +126,15 @@ SELECT * FROM t_order A WHERE idx > %d AND net_id = %d AND status="%s"
} }
} }
nfts := []struct{ rspObj := struct {
idx int64 ErrCode int32 `json:"errcode"`
netId int32 ErrMsg string `json:"errmsg"`
tokenType int32 Page common.StreamPagination `json:"page"`
tokenId string Rows []interface{} `json:"rows"`
contractAddress string }{
}{} Rows : []interface{}{},
}
nfts := []*common.NftDto{}
f5.GetGoStyleDb().StreamPageQuery( f5.GetGoStyleDb().StreamPageQuery(
constant.BCNFT_DB, constant.BCNFT_DB,
pageSize, pageSize,
@ -141,18 +145,22 @@ SELECT * FROM t_order A WHERE idx > %d AND net_id = %d AND status="%s"
f5.GetDbFilter().Comp(subFilters...), f5.GetDbFilter().Comp(subFilters...),
orderBy, orderBy,
func (err error, pagination *f5.StreamPagination) { func (err error, pagination *f5.StreamPagination) {
rspObj.Page.FillPage(pagination)
}, },
func (ds *f5.DataSet) { func (ds *f5.DataSet) {
var p = q5.NewSliceElement(&nfts) p := new(common.NftDto)
p.idx = q5.ToInt64(ds.GetByName("idx")) p.NetId = q5.ToInt32(ds.GetByName("net_id"))
p.netId = q5.ToInt32(ds.GetByName("net_id")) p.ContractAddress = ds.GetByName("contract_address")
p.tokenType = q5.ToInt32(ds.GetByName("token_type")) p.TokenId = ds.GetByName("token_id")
p.tokenId = ds.GetByName("token_id") q5.AppendSlice(&nfts, p)
p.contractAddress = ds.GetByName("contract_address")
f5.GetSysLog().Info("idx:%s", p.idx)
}) })
f5.GetSysLog().Info("dafdf") GetCacheMgr().GetNfts(nfts)
{
for _, val := range nfts {
q5.AppendSlice(&rspObj.Rows, val.NftCache.GetJsonData())
}
}
c.JSON(200, rspObj)
} }
func (this *MarketApi) TransactionHistory(c *gin.Context) { func (this *MarketApi) TransactionHistory(c *gin.Context) {

View File

@ -9,7 +9,7 @@ type MarketRouter struct{}
func (this *MarketRouter) InitRouter() { func (this *MarketRouter) InitRouter() {
api := v1.ApiGroupApp.MarketApiGroup api := v1.ApiGroupApp.MarketApiGroup
f5.GetApp().GetGinEngine().GET("/api/market/product/list/:net_id", api.MarketApi.ProductList) f5.GetApp().GetGinEngine().POST("/api/market/product/list/:net_id", api.MarketApi.ProductList)
f5.GetApp().GetGinEngine().GET("/api/market/transaction/history/:net_id/:account_address", f5.GetApp().GetGinEngine().GET("/api/market/transaction/history/:net_id/:account_address",
api.MarketApi.TransactionHistory) api.MarketApi.TransactionHistory)
} }