This commit is contained in:
aozhiwei 2024-06-13 13:38:53 +08:00
parent b2c45ca99f
commit edb09e4e32
6 changed files with 66 additions and 4 deletions

View File

@ -2,4 +2,5 @@ package nft
type ApiGroup struct {
NftMetaApi
NftDetailApi
}

View File

@ -0,0 +1,45 @@
package nft
import (
"f5"
"mt"
"github.com/gin-gonic/gin"
)
type NftDetailApi struct {
}
func (this *NftDetailApi) 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 *NftDetailApi) 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())
})
}

View File

@ -2,4 +2,5 @@ package nft
type RouterGroup struct {
NftMetaRouter
NftDetailRouter
}

View File

@ -0,0 +1,14 @@
package nft
import (
"f5"
"main/api/v1"
)
type NftDetailRouter struct{}
func (this *NftDetailRouter) InitRouter() {
api := v1.ApiGroupApp.NftApiGroup
f5.GetApp().GetGinEngine().GET("/hero/detail/:netId/:tokenId", api.NftDetailApi.Hero)
f5.GetApp().GetGinEngine().GET("/gold_bullion/detail/:netId/:tokenId", api.NftDetailApi.GoldBullion)
}

View File

@ -9,8 +9,8 @@ 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)
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)
}

View File

@ -20,6 +20,7 @@ func (this *routerMgr) Init() {
this.ca.InitServerSwitchRouter()
this.nft.NftMetaRouter.InitRouter()
this.nft.NftDetailRouter.InitRouter()
f5.GetSysLog().Info("routerMgr.init")