This commit is contained in:
aozhiwei 2024-07-16 13:49:48 +08:00
parent a3ee1e4b1f
commit 1954eb4971
6 changed files with 67 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import (
"main/api/v1/gold_bullion"
"main/api/v1/shopcart"
"main/api/v1/nft"
"main/api/v1/ingame"
)
type ApiGroup struct {
@ -16,6 +17,7 @@ type ApiGroup struct {
GoldBullionApiGroup gold_bullion.ApiGroup
ShopCartApiGroup shopcart.ApiGroup
NftApiGroup nft.ApiGroup
InGameApiGroup ingame.ApiGroup
}
var ApiGroupApp = new(ApiGroup)

View File

@ -0,0 +1,5 @@
package ingame
type ApiGroup struct {
InGameApi
}

View File

@ -0,0 +1,40 @@
package ingame
import (
"f5"
"github.com/gin-gonic/gin"
)
type InGameApi struct {
}
func (this *InGameApi) HeroList(c *gin.Context) {
reqJson := struct {
NetId interface{} `json:"net_id"`
ContractAddress string `json:"contract_address"`
To string `json:"to"`
Tokens struct {
TokenId string `json:"token_id"`
} `json:"tokens"`
}{}
if err := c.ShouldBindJSON(&reqJson); err != nil {
f5.RspErr(c, 401, "params parse error")
return
}
}
func (this *InGameApi) HeroMint(c *gin.Context) {
reqJson := struct {
NetId interface{} `json:"net_id"`
ContractAddress string `json:"contract_address"`
To string `json:"to"`
Tokens struct {
TokenId string `json:"token_id"`
} `json:"tokens"`
}{}
if err := c.ShouldBindJSON(&reqJson); err != nil {
f5.RspErr(c, 401, "params parse error")
return
}
}

View File

@ -0,0 +1,5 @@
package ingame
type RouterGroup struct {
IngameRouter
}

View File

@ -0,0 +1,14 @@
package ingame
import (
"f5"
"main/api/v1"
)
type IngameRouter struct{}
func (this *IngameRouter) InitRouter() {
api := v1.ApiGroupApp.IngameApiGroup
f5.GetApp().GetGinEngine().GET("/api/ingame/asset/hero/list", api.IngameApi.HeroList)
f5.GetApp().GetGinEngine().POST("/api/ingame/asset/hero/mint", api.IngameApi.HeroMint)
}

View File

@ -9,5 +9,5 @@ type NftRouter struct{}
func (this *NftRouter) InitRouter() {
api := v1.ApiGroupApp.NftApiGroup
f5.GetApp().GetGinEngine().GET("/api/nft/stacking/unlock", api.NftApi.Unlock)
f5.GetApp().GetGinEngine().POST("/api/nft/stacking/unlock", api.NftApi.Unlock)
}