1
This commit is contained in:
parent
b566b8263e
commit
a1b755aebd
28
server/marketserver/api/v1/asset/asset.go
Normal file
28
server/marketserver/api/v1/asset/asset.go
Normal file
@ -0,0 +1,28 @@
|
||||
package asset
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"mt"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type AssetApi struct {
|
||||
|
||||
}
|
||||
|
||||
func (this *AssetApi) AccountAsset(c *gin.Context) {
|
||||
netId := c.Param("netId")
|
||||
tokenId := c.Param("tokenId")
|
||||
f5.GetHttpCliMgr().SendGoStyleRequest(
|
||||
mt.Table.Config.GetGameApiUrl() + "/webapp/index.php",
|
||||
map[string]string{
|
||||
"c": "OutAppNft",
|
||||
"a": "nftMetaView",
|
||||
"nft_type": "hero",
|
||||
"net_id": netId,
|
||||
"token_id": tokenId,
|
||||
},
|
||||
func (rsp f5.HttpCliResponse) {
|
||||
c.String(200, rsp.GetRawData())
|
||||
})
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
package nft
|
||||
package asset
|
||||
|
||||
type ApiGroup struct {
|
||||
NftMetaApi
|
||||
AssetApi
|
||||
}
|
@ -1,11 +1,13 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"main/api/v1/nft"
|
||||
"main/api/v1/market"
|
||||
"main/api/v1/asset"
|
||||
)
|
||||
|
||||
type ApiGroup struct {
|
||||
NftApiGroup nft.ApiGroup
|
||||
MarketApiGroup market.ApiGroup
|
||||
AssetApiGroup asset.ApiGroup
|
||||
}
|
||||
|
||||
var ApiGroupApp = new(ApiGroup)
|
||||
|
5
server/marketserver/api/v1/market/enter.go
Normal file
5
server/marketserver/api/v1/market/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package market
|
||||
|
||||
type ApiGroup struct {
|
||||
MarketApi
|
||||
}
|
45
server/marketserver/api/v1/market/market.go
Normal file
45
server/marketserver/api/v1/market/market.go
Normal file
@ -0,0 +1,45 @@
|
||||
package market
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"mt"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type MarketApi struct {
|
||||
|
||||
}
|
||||
|
||||
func (this *MarketApi) ProductList(c *gin.Context) {
|
||||
netId := c.Param("netId")
|
||||
tokenId := c.Param("tokenId")
|
||||
f5.GetHttpCliMgr().SendGoStyleRequest(
|
||||
mt.Table.Config.GetGameApiUrl() + "/webapp/index.php",
|
||||
map[string]string{
|
||||
"c": "OutAppNft",
|
||||
"a": "nftMetaView",
|
||||
"nft_type": "hero",
|
||||
"net_id": netId,
|
||||
"token_id": tokenId,
|
||||
},
|
||||
func (rsp f5.HttpCliResponse) {
|
||||
c.String(200, rsp.GetRawData())
|
||||
})
|
||||
}
|
||||
|
||||
func (this *MarketApi) TransactionHistory(c *gin.Context) {
|
||||
netId := c.Param("netId")
|
||||
tokenId := c.Param("tokenId")
|
||||
f5.GetHttpCliMgr().SendGoStyleRequest(
|
||||
mt.Table.Config.GetGameApiUrl() + "/webapp/index.php",
|
||||
map[string]string{
|
||||
"c": "OutAppNft",
|
||||
"a": "nftMetaView",
|
||||
"nft_type": "gold_bullion",
|
||||
"net_id": netId,
|
||||
"token_id": tokenId,
|
||||
},
|
||||
func (rsp f5.HttpCliResponse) {
|
||||
c.String(200, rsp.GetRawData())
|
||||
})
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
package nft
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"mt"
|
||||
"main/common"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type NftMetaApi struct {
|
||||
|
||||
}
|
||||
|
||||
func (this *NftMetaApi) Hero(c *gin.Context) {
|
||||
netId := c.Param("netId")
|
||||
tokenId := c.Param("tokenId")
|
||||
f5.GetHttpCliMgr().SendGoStyleRequest(
|
||||
mt.Table.Config.GetGameApiUrl() + "/webapp/index.php",
|
||||
map[string]string{
|
||||
"c": "OutAppNft",
|
||||
"a": "nftMetaView",
|
||||
"nft_type": "hero",
|
||||
"net_id": netId,
|
||||
"token_id": tokenId,
|
||||
},
|
||||
func (rsp f5.HttpCliResponse) {
|
||||
c.String(200, rsp.GetRawData())
|
||||
})
|
||||
}
|
||||
|
||||
func (this *NftMetaApi) GoldBullion(c *gin.Context) {
|
||||
netId := c.Param("netId")
|
||||
tokenId := c.Param("tokenId")
|
||||
f5.GetHttpCliMgr().SendGoStyleRequest(
|
||||
mt.Table.Config.GetGameApiUrl() + "/webapp/index.php",
|
||||
map[string]string{
|
||||
"c": "OutAppNft",
|
||||
"a": "nftMetaView",
|
||||
"nft_type": "gold_bullion",
|
||||
"net_id": netId,
|
||||
"token_id": tokenId,
|
||||
},
|
||||
func (rsp f5.HttpCliResponse) {
|
||||
c.String(200, rsp.GetRawData())
|
||||
})
|
||||
}
|
||||
|
||||
func (this *NftMetaApi) HeroHome(c *gin.Context) {
|
||||
meta := mt.Table.NftHomeMeta.GetHeroMeta()
|
||||
rspObj := new(common.NftHomeMeta)
|
||||
if meta != nil {
|
||||
rspObj.Name = meta.GetNftName()
|
||||
rspObj.Symbol = meta.GetNftSymbol()
|
||||
rspObj.Description = meta.GetNftDescription()
|
||||
rspObj.Image = meta.GetNftImage()
|
||||
rspObj.ExternalLink = meta.GetNftExternalLink()
|
||||
}
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
||||
func (this *NftMetaApi) GoldBullionHome(c *gin.Context) {
|
||||
meta := mt.Table.NftHomeMeta.GetGoldBullionMeta()
|
||||
rspObj := new(common.NftHomeMeta)
|
||||
if meta != nil {
|
||||
rspObj.Name = meta.GetNftName()
|
||||
rspObj.Symbol = meta.GetNftSymbol()
|
||||
rspObj.Description = meta.GetNftDescription()
|
||||
rspObj.Image = meta.GetNftImage()
|
||||
rspObj.ExternalLink = meta.GetNftExternalLink()
|
||||
}
|
||||
c.JSON(200, rspObj)
|
||||
}
|
13
server/marketserver/router/asset/asset.go
Normal file
13
server/marketserver/router/asset/asset.go
Normal file
@ -0,0 +1,13 @@
|
||||
package asset
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/api/v1"
|
||||
)
|
||||
|
||||
type AssetRouter struct{}
|
||||
|
||||
func (this *AssetRouter) InitRouter() {
|
||||
api := v1.ApiGroupApp.AssetApiGroup
|
||||
f5.GetApp().GetGinEngine().GET("/api/asset/:net_id/:account_address", api.AssetApi.AccountAsset)
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
package nft
|
||||
package asset
|
||||
|
||||
type RouterGroup struct {
|
||||
NftMetaRouter
|
||||
AssetRouter
|
||||
}
|
5
server/marketserver/router/market/enter.go
Normal file
5
server/marketserver/router/market/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package market
|
||||
|
||||
type RouterGroup struct {
|
||||
MarketRouter
|
||||
}
|
15
server/marketserver/router/market/market.go
Normal file
15
server/marketserver/router/market/market.go
Normal file
@ -0,0 +1,15 @@
|
||||
package market
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/api/v1"
|
||||
)
|
||||
|
||||
type MarketRouter struct{}
|
||||
|
||||
func (this *MarketRouter) InitRouter() {
|
||||
api := v1.ApiGroupApp.MarketApiGroup
|
||||
f5.GetApp().GetGinEngine().GET("/api/market/product/list/:net_id", api.MarketApi.ProductList)
|
||||
f5.GetApp().GetGinEngine().GET("/api/market/transaction/history/:net_id/:account_address",
|
||||
api.MarketApi.TransactionHistory)
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package nft
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/api/v1"
|
||||
)
|
||||
|
||||
type NftMetaRouter struct{}
|
||||
|
||||
func (this *NftMetaRouter) InitRouter() {
|
||||
api := v1.ApiGroupApp.NftApiGroup
|
||||
f5.GetApp().GetGinEngine().GET("hero/meta/:netId/:tokenId", api.NftMetaApi.Hero)
|
||||
f5.GetApp().GetGinEngine().GET("gold_bullion/meta/:netId/:tokenId", api.NftMetaApi.GoldBullion)
|
||||
f5.GetApp().GetGinEngine().GET("hero/home_meta/:netId", api.NftMetaApi.HeroHome)
|
||||
f5.GetApp().GetGinEngine().GET("gold_bullion/home_meta/:netId", api.NftMetaApi.GoldBullionHome)
|
||||
}
|
@ -2,11 +2,13 @@ package router
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/router/nft"
|
||||
"main/router/market"
|
||||
"main/router/asset"
|
||||
)
|
||||
|
||||
type routerMgr struct {
|
||||
nft nft.RouterGroup
|
||||
market market.RouterGroup
|
||||
asset asset.RouterGroup
|
||||
}
|
||||
|
||||
func (this *routerMgr) Init() {
|
||||
@ -14,7 +16,8 @@ func (this *routerMgr) Init() {
|
||||
f5.GetApp().GetGinEngine().Use(middleware.Cors())
|
||||
*/
|
||||
|
||||
this.nft.NftMetaRouter.InitRouter()
|
||||
this.market.MarketRouter.InitRouter()
|
||||
this.asset.AssetRouter.InitRouter()
|
||||
|
||||
f5.GetSysLog().Info("routerMgr.init")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user