This commit is contained in:
aozhiwei 2024-06-13 17:51:25 +08:00
parent 56585dbece
commit 4dd828b197
5 changed files with 59 additions and 16 deletions

View File

@ -1,6 +1,6 @@
[ [
{ {
"instance_id": 1, "instance_id": 1,
"http_listen_port": 9993 "http_listen_port": 9996
} }
] ]

View File

@ -1,8 +1,11 @@
package asset package asset
import ( import (
"q5"
"f5" "f5"
"mt" "main/constant"
"fmt"
"strings"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -10,19 +13,41 @@ type AssetApi struct {
} }
/*
filterType: 0:全部 1:已上架 2:未上架
*/
func (this *AssetApi) AccountAsset(c *gin.Context) { func (this *AssetApi) AccountAsset(c *gin.Context) {
netId := c.Param("netId") pageSize := q5.ToInt32(c.DefaultQuery("page_size", ""))
tokenId := c.Param("tokenId") cursor := q5.ToInt64(c.DefaultQuery("cursor", ""))
f5.GetHttpCliMgr().SendGoStyleRequest( netId := q5.ToInt64(c.Param("net_id"))
mt.Table.Config.GetGameApiUrl() + "/webapp/index.php", accountAddress := strings.ToLower(c.Param("account_address"))
map[string]string{ //searchName := c.DefaultQuery("search_name", "")
"c": "OutAppNft", filterType := q5.ToInt32(c.DefaultQuery("type", ""))
"a": "nftMetaView", sql := fmt.Sprintf(`
"nft_type": "hero", SELECT A.idx, A.net_id, A.token_type, A.token_id, B.status FROM t_nft A LEFT JOIN t_order B
"net_id": netId, ON A.net_id = B.net_id AND A.contract_address = B.contract_address AND A.token_id = B.token_id
"token_id": tokenId, WHERE A.idx > %d AND A.net_id = %d AND A.owner_address=? LIMIT %d`,
cursor, netId, pageSize + 1)
if filterType == 1 {
sql += "B.status = '" + constant.ORDER_STATUS_ACTIVE + "'"
} else if filterType == 2 {
sql += "B.status <> '" + constant.ORDER_STATUS_ACTIVE + "'"
}
f5.GetGoStyleDb().StreamPageQuery(
constant.BCNFT_DB,
pageSize,
cursor,
sql,
[]string{
accountAddress,
}, },
func (rsp f5.HttpCliResponse) { f5.GetDbFilter().Comp(
c.String(200, rsp.GetRawData()) ),
"",
func (err error, pagination *f5.StreamPagination) {
},
func (ds *f5.DataSet) {
}) })
} }

View File

@ -3,6 +3,7 @@ package app
import ( import (
"f5" "f5"
"mt" "mt"
"main/constant"
) )
type app struct { type app struct {
@ -11,7 +12,7 @@ type app struct {
} }
func (this *app) GetPkgName() string { func (this *app) GetPkgName() string {
return "nftserver" return "marketserver"
} }
func (this *app) GetHttpListenPort() int32 { func (this *app) GetHttpListenPort() int32 {
@ -38,6 +39,14 @@ func (this *app) Update() {
} }
func (this *app) registerDataSources() { func (this *app) registerDataSources() {
f5.GetGoStyleDb().RegisterDataSource(
constant.BCNFT_DB,
mt.Table.NftDb.GetById(0).GetHost(),
mt.Table.NftDb.GetById(0).GetPort(),
mt.Table.NftDb.GetById(0).GetUser(),
mt.Table.NftDb.GetById(0).GetPasswd(),
mt.Table.NftDb.GetById(0).GetDatabase(),
3)
} }
func (this *app) HasTask() bool { func (this *app) HasTask() bool {

View File

@ -9,3 +9,12 @@ const (
ROUTER_MGR_MODULE_IDX ROUTER_MGR_MODULE_IDX
MAX_MODULE_IDX MAX_MODULE_IDX
) )
const (
ORDER_STATUS_PENDING = "PENDING"
ORDER_STATUS_ACTIVE = "ACTIVE"
ORDER_STATUS_INACTIVE = "INACTIVE"
ORDER_STATUS_CANCELLED = "CANCELLED"
ORDER_STATUS_FILLED = "FILLED"
ORDER_STATUS_EXPIRED = "EXPIRED"
)

2
third_party/f5 vendored

@ -1 +1 @@
Subproject commit 684e548134643975d38213c017ac4cdb5577a8c0 Subproject commit ee715d672d83932a6a20f810cc490d737fad01e6