This commit is contained in:
aozhiwei 2024-07-19 16:16:34 +08:00
parent c50c47d979
commit b279049d2d
4 changed files with 46 additions and 0 deletions

View File

@ -7,6 +7,14 @@
"nft_image": "https://res2.counterfire.games/nft/home_meta/home.jpg",
"nft_external_link": "https://www.counterfire.games"
},
{
"name": "new_hero",
"nft_name": "COUNTERFIRE | Legacy Heroes",
"nft_symbol": "Heroes",
"nft_description": "The Legacy Heroes NFT collection grants access to play-to-earn (P2E) features in the Counter Fire game.",
"nft_image": "https://res2.counterfire.games/nft/home_meta/home.jpg",
"nft_external_link": "https://www.counterfire.games"
},
{
"name": "gold_bullion",
"nft_name": "COUNTERFIRE | Gold Fusion Card",

View File

@ -30,6 +30,23 @@ func (this *NftMetaApi) Hero(c *gin.Context) {
})
}
func (this *NftMetaApi) NewHero(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",
"net_id": netId,
"token_type": q5.ToString(jccommon.NFT_TYPE_CFHERO_NORMAL),
"token_id": tokenId,
},
func (rsp f5.HttpCliResponse) {
c.Data(200, "application/json", []byte(rsp.GetRawData()))
})
}
func (this *NftMetaApi) GoldBullion(c *gin.Context) {
netId := c.Param("netId")
tokenId := c.Param("tokenId")
@ -48,6 +65,19 @@ func (this *NftMetaApi) GoldBullion(c *gin.Context) {
}
func (this *NftMetaApi) HeroHome(c *gin.Context) {
meta := mt.Table.NftHomeMeta.GetNewHeroMeta()
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) NewHeroHome(c *gin.Context) {
meta := mt.Table.NftHomeMeta.GetHeroMeta()
rspObj := new(common.NftHomeMeta)
if meta != nil {

View File

@ -12,6 +12,7 @@ type NftHomeMeta struct {
type NftHomeMetaTable struct {
f5.NameMetaTable[NftHomeMeta]
hero *NftHomeMeta
newHero *NftHomeMeta
goldBullion *NftHomeMeta
}
@ -19,11 +20,16 @@ func (this *NftHomeMetaTable) GetHeroMeta() *NftHomeMeta {
return this.hero
}
func (this *NftHomeMetaTable) GetNewHeroMeta() *NftHomeMeta {
return this.newHero
}
func (this *NftHomeMetaTable) GetGoldBullionMeta() *NftHomeMeta {
return this.goldBullion
}
func (this *NftHomeMetaTable) PostInit1() {
this.hero = this.GetByName("hero")
this.newHero = this.GetByName("new_hero")
this.goldBullion = this.GetByName("gold_bullion")
}

View File

@ -10,7 +10,9 @@ 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("/newhero/meta/:netId/:tokenId", api.NftMetaApi.NewHero)
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("/new/hero/home_meta/:netId", api.NftMetaApi.NewHeroHome)
f5.GetApp().GetGinEngine().GET("/gold_bullion/home_meta/:netId", api.NftMetaApi.GoldBullionHome)
}