This commit is contained in:
aozhiwei 2024-06-06 11:22:34 +08:00
parent dce2265279
commit a0e8f32b13
6 changed files with 145 additions and 0 deletions

View File

@ -43,3 +43,37 @@ func (this *NftMetaApi) GoldBullion(c *gin.Context) {
c.String(200, rsp.GetRawData())
})
}
func (this *NftMetaApi) HeroHome(c *gin.Context) {
netId := c.Param("netId")
tokenId := c.Param("tokenId")
f5.GetHttpCliMgr().SendGoStyleRequest(
mt.Table.Config.GetGameApiUrl(),
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 *NftMetaApi) GoldBullionHome(c *gin.Context) {
netId := c.Param("netId")
tokenId := c.Param("tokenId")
f5.GetHttpCliMgr().SendGoStyleRequest(
mt.Table.Config.GetGameApiUrl(),
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

@ -0,0 +1,24 @@
package mt
import (
"f5"
"mtb"
)
type NftHomeMeta struct {
mtb.NftHomeMeta
}
type NftHomeMetaTable struct {
f5.NameMetaTable[NftHomeMeta]
hero *NftHomeMeta
goldBullion *NftHomeMeta
}
func (this *NftHomeMetaTable) GetHeroMeta() *NftHomeMeta {
return this.hero
}
func (this *NftHomeMetaTable) GetGoldBullionMeta() *NftHomeMeta {
return this.goldBullion
}

View File

@ -8,6 +8,7 @@ type table struct {
NftServerCluster *NftServerClusterTable
NftDb *NftDbTable
Config *ConfigTable
NftHomeMeta *NftHomeMetaTable
}
var Table = f5.New(func(this *table) {
@ -25,4 +26,9 @@ var Table = f5.New(func(this *table) {
this.FileName = "../config/config.json"
this.PrimKey = ""
})
this.NftHomeMeta = f5.New(func(this *NftHomeMetaTable) {
this.FileName = "../config/nft_home_meta.json"
this.PrimKey = "internal_name"
})
})

View File

@ -31,6 +31,18 @@ type Config struct {
_flags2_ uint64
}
type NftHomeMeta struct {
internal_name string
name string
symbol string
description string
image string
external_link string
_flags1_ uint64
_flags2_ uint64
}
func (this *NftServerCluster) GetInstanceId() int32 {
return this.instance_id
}
@ -103,6 +115,54 @@ func (this *Config) HasGameapiUrl() bool {
return (this._flags1_ & (uint64(1) << 1)) > 0
}
func (this *NftHomeMeta) GetInternalName() string {
return this.internal_name
}
func (this *NftHomeMeta) HasInternalName() bool {
return (this._flags1_ & (uint64(1) << 1)) > 0
}
func (this *NftHomeMeta) GetName() string {
return this.name
}
func (this *NftHomeMeta) HasName() bool {
return (this._flags1_ & (uint64(1) << 3)) > 0
}
func (this *NftHomeMeta) GetSymbol() string {
return this.symbol
}
func (this *NftHomeMeta) HasSymbol() bool {
return (this._flags1_ & (uint64(1) << 4)) > 0
}
func (this *NftHomeMeta) GetDescription() string {
return this.description
}
func (this *NftHomeMeta) HasDescription() bool {
return (this._flags1_ & (uint64(1) << 5)) > 0
}
func (this *NftHomeMeta) GetImage() string {
return this.image
}
func (this *NftHomeMeta) HasImage() bool {
return (this._flags1_ & (uint64(1) << 6)) > 0
}
func (this *NftHomeMeta) GetExternalLink() string {
return this.external_link
}
func (this *NftHomeMeta) HasExternalLink() bool {
return (this._flags1_ & (uint64(1) << 7)) > 0
}
func (this *NftServerCluster) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
@ -121,3 +181,12 @@ func (this *NftDb) LoadFromKv(kv map[string]interface{}) {
func (this *Config) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv)
}
func (this *NftHomeMeta) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.internal_name, "internal_name", &this._flags1_, 1, kv)
f5.ReadMetaTableField(&this.name, "name", &this._flags1_, 3, kv)
f5.ReadMetaTableField(&this.symbol, "symbol", &this._flags1_, 4, kv)
f5.ReadMetaTableField(&this.description, "description", &this._flags1_, 5, kv)
f5.ReadMetaTableField(&this.image, "image", &this._flags1_, 6, kv)
f5.ReadMetaTableField(&this.external_link, "external_link", &this._flags1_, 7, kv)
}

View File

@ -22,3 +22,13 @@ message Config
{
optional string gameapi_url = 1;
}
message NftHomeMeta
{
optional string internal_name = 1;
optional string name = 3;
optional string symbol = 4;
optional string description = 5;
optional string image = 6;
optional string external_link = 7;
}

View File

@ -11,4 +11,6 @@ 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)
}