From 1954eb49713a633c06c9e391f048fb8ac8508f23 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 16 Jul 2024 13:49:48 +0800 Subject: [PATCH] 1 --- server/marketserver/api/v1/enter.go | 2 ++ server/marketserver/api/v1/ingame/enter.go | 5 +++ server/marketserver/api/v1/ingame/ingame.go | 40 +++++++++++++++++++++ server/marketserver/router/ingame/enter.go | 5 +++ server/marketserver/router/ingame/ingame.go | 14 ++++++++ server/marketserver/router/nft/nft.go | 2 +- 6 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 server/marketserver/api/v1/ingame/enter.go create mode 100644 server/marketserver/api/v1/ingame/ingame.go create mode 100644 server/marketserver/router/ingame/enter.go create mode 100644 server/marketserver/router/ingame/ingame.go diff --git a/server/marketserver/api/v1/enter.go b/server/marketserver/api/v1/enter.go index 6dd8782e..eee220bd 100644 --- a/server/marketserver/api/v1/enter.go +++ b/server/marketserver/api/v1/enter.go @@ -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) diff --git a/server/marketserver/api/v1/ingame/enter.go b/server/marketserver/api/v1/ingame/enter.go new file mode 100644 index 00000000..cf4fe610 --- /dev/null +++ b/server/marketserver/api/v1/ingame/enter.go @@ -0,0 +1,5 @@ +package ingame + +type ApiGroup struct { + InGameApi +} diff --git a/server/marketserver/api/v1/ingame/ingame.go b/server/marketserver/api/v1/ingame/ingame.go new file mode 100644 index 00000000..cccd0f38 --- /dev/null +++ b/server/marketserver/api/v1/ingame/ingame.go @@ -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 + } +} diff --git a/server/marketserver/router/ingame/enter.go b/server/marketserver/router/ingame/enter.go new file mode 100644 index 00000000..7ed13fc4 --- /dev/null +++ b/server/marketserver/router/ingame/enter.go @@ -0,0 +1,5 @@ +package ingame + +type RouterGroup struct { + IngameRouter +} diff --git a/server/marketserver/router/ingame/ingame.go b/server/marketserver/router/ingame/ingame.go new file mode 100644 index 00000000..7f8a966b --- /dev/null +++ b/server/marketserver/router/ingame/ingame.go @@ -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) +} diff --git a/server/marketserver/router/nft/nft.go b/server/marketserver/router/nft/nft.go index a33a51bd..5d7dc4b3 100644 --- a/server/marketserver/router/nft/nft.go +++ b/server/marketserver/router/nft/nft.go @@ -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) }