This commit is contained in:
aozhiwei 2024-07-16 13:41:18 +08:00
parent 103ac706ff
commit a3ee1e4b1f
6 changed files with 53 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import (
"main/api/v1/hero"
"main/api/v1/gold_bullion"
"main/api/v1/shopcart"
"main/api/v1/nft"
)
type ApiGroup struct {
@ -14,6 +15,7 @@ type ApiGroup struct {
HeroApiGroup hero.ApiGroup
GoldBullionApiGroup gold_bullion.ApiGroup
ShopCartApiGroup shopcart.ApiGroup
NftApiGroup nft.ApiGroup
}
var ApiGroupApp = new(ApiGroup)

View File

@ -0,0 +1,5 @@
package nft
type ApiGroup struct {
NftApi
}

View File

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

View File

@ -0,0 +1,13 @@
package nft
import (
"f5"
"main/api/v1"
)
type NftRouter struct{}
func (this *NftRouter) InitRouter() {
api := v1.ApiGroupApp.NftApiGroup
f5.GetApp().GetGinEngine().GET("/api/nft/stacking/unlock", api.NftApi.Unlock)
}

View File

@ -8,6 +8,7 @@ import (
"main/router/hero"
"main/router/gold_bullion"
"main/router/shopcart"
"main/router/nft"
)
type routerMgr struct {
@ -16,6 +17,7 @@ type routerMgr struct {
hero hero.RouterGroup
goldBullion gold_bullion.RouterGroup
shopCart shopcart.RouterGroup
nft nft.RouterGroup
}
func (this *routerMgr) Init() {
@ -25,6 +27,7 @@ func (this *routerMgr) Init() {
this.hero.HeroRouter.InitRouter()
this.goldBullion.GoldBullionRouter.InitRouter()
this.shopCart.ShopCartRouter.InitRouter()
this.nft.NftRouter.InitRouter()
f5.GetSysLog().Info("routerMgr.init")