1
This commit is contained in:
parent
37aa2028aa
commit
9098a00488
11
server/wheelserver/api/v1/enter.go
Normal file
11
server/wheelserver/api/v1/enter.go
Normal file
@ -0,0 +1,11 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"main/api/v1/nft"
|
||||
)
|
||||
|
||||
type ApiGroup struct {
|
||||
NftApiGroup nft.ApiGroup
|
||||
}
|
||||
|
||||
var ApiGroupApp = new(ApiGroup)
|
6
server/wheelserver/api/v1/nft/enter.go
Normal file
6
server/wheelserver/api/v1/nft/enter.go
Normal file
@ -0,0 +1,6 @@
|
||||
package nft
|
||||
|
||||
type ApiGroup struct {
|
||||
NftMetaApi
|
||||
NftDetailApi
|
||||
}
|
61
server/wheelserver/api/v1/nft/nftdetail.go
Normal file
61
server/wheelserver/api/v1/nft/nftdetail.go
Normal file
@ -0,0 +1,61 @@
|
||||
package nft
|
||||
|
||||
import (
|
||||
"q5"
|
||||
"f5"
|
||||
"main/mt"
|
||||
"jccommon"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type NftDetailApi struct {
|
||||
|
||||
}
|
||||
|
||||
func (this *NftDetailApi) Hero(c *gin.Context) {
|
||||
netId := q5.ToInt32(c.Param("netId"))
|
||||
tokenId := c.Param("tokenId")
|
||||
/*contractMeta := mt.Table.Contract.GetByNetIdName(netId, constant.CONTRACT_NAME_CFHero)
|
||||
contractAddress := ""
|
||||
if contractMeta != nil {
|
||||
contractAddress = contractMeta.GetAddress()
|
||||
}*/
|
||||
f5.GetHttpCliMgr().SendGoStyleRequest(
|
||||
mt.Table.Config.GetGameApiUrl() + "/webapp/index.php",
|
||||
map[string]string{
|
||||
"c": "OutAppNft",
|
||||
"a": "nftDetailByTokenType",
|
||||
//"contract_address": contractAddress,
|
||||
"net_id": q5.ToString(netId),
|
||||
"token_type": q5.ToString(jccommon.NFT_TYPE_CFHERO),
|
||||
"token_id": tokenId,
|
||||
},
|
||||
func (rsp f5.HttpCliResponse) {
|
||||
c.Data(200, "application/json", []byte(rsp.GetRawData()))
|
||||
//c.String(200, rsp.GetRawData())
|
||||
})
|
||||
}
|
||||
|
||||
func (this *NftDetailApi) GoldBullion(c *gin.Context) {
|
||||
netId := q5.ToInt32(c.Param("netId"))
|
||||
tokenId := c.Param("tokenId")
|
||||
/*
|
||||
contractMeta := mt.Table.Contract.GetByNetIdName(netId, constant.CONTRACT_NAME_GoldBrick)
|
||||
contractAddress := ""
|
||||
if contractMeta != nil {
|
||||
contractAddress = contractMeta.GetAddress()
|
||||
}*/
|
||||
f5.GetHttpCliMgr().SendGoStyleRequest(
|
||||
mt.Table.Config.GetGameApiUrl() + "/webapp/index.php",
|
||||
map[string]string{
|
||||
"c": "OutAppNft",
|
||||
"a": "nftDetailByTokenType",
|
||||
//"contract_address": contractAddress,
|
||||
"net_id": q5.ToString(netId),
|
||||
"token_type": q5.ToString(jccommon.NFT_TYPE_GOLD_BULLION),
|
||||
"token_id": tokenId,
|
||||
},
|
||||
func (rsp f5.HttpCliResponse) {
|
||||
c.Data(200, "application/json", []byte(rsp.GetRawData()))
|
||||
})
|
||||
}
|
104
server/wheelserver/api/v1/nft/nftmeta.go
Normal file
104
server/wheelserver/api/v1/nft/nftmeta.go
Normal file
@ -0,0 +1,104 @@
|
||||
package nft
|
||||
|
||||
import (
|
||||
"q5"
|
||||
"f5"
|
||||
"main/mt"
|
||||
"jccommon"
|
||||
"main/common"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type NftMetaApi struct {
|
||||
|
||||
}
|
||||
|
||||
func (this *NftMetaApi) Hero(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),
|
||||
"token_id": tokenId,
|
||||
},
|
||||
func (rsp f5.HttpCliResponse) {
|
||||
c.Data(200, "application/json", []byte(rsp.GetRawData()))
|
||||
})
|
||||
}
|
||||
|
||||
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")
|
||||
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_GOLD_BULLION),
|
||||
"token_id": tokenId,
|
||||
},
|
||||
func (rsp f5.HttpCliResponse) {
|
||||
c.Data(200, "application/json", []byte(rsp.GetRawData()))
|
||||
})
|
||||
}
|
||||
|
||||
func (this *NftMetaApi) HeroHome(c *gin.Context) {
|
||||
meta := mt.Table.NftHomeMeta.GetHeroMeta()
|
||||
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.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) GoldBullionHome(c *gin.Context) {
|
||||
meta := mt.Table.NftHomeMeta.GetGoldBullionMeta()
|
||||
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)
|
||||
}
|
45
server/wheelserver/app/app.go
Normal file
45
server/wheelserver/app/app.go
Normal file
@ -0,0 +1,45 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mt"
|
||||
)
|
||||
|
||||
type app struct {
|
||||
initCb func()
|
||||
unInitCb func()
|
||||
}
|
||||
|
||||
func (this *app) GetPkgName() string {
|
||||
return "nftserver"
|
||||
}
|
||||
|
||||
func (this *app) GetHttpListenPort() int32 {
|
||||
return mt.Table.NftServerCluster.GetHttpListenPort()
|
||||
}
|
||||
|
||||
func (this *app) Run(initCb func(), unInitCb func()) {
|
||||
this.initCb = initCb
|
||||
this.unInitCb = unInitCb
|
||||
f5.Run(this)
|
||||
}
|
||||
|
||||
func (this *app) Init() {
|
||||
f5.LoadMetaTable(mt.Table)
|
||||
this.registerDataSources()
|
||||
this.initCb()
|
||||
}
|
||||
|
||||
func (this *app) UnInit() {
|
||||
this.unInitCb()
|
||||
}
|
||||
|
||||
func (this *app) Update() {
|
||||
}
|
||||
|
||||
func (this *app) registerDataSources() {
|
||||
}
|
||||
|
||||
func (this *app) HasTask() bool {
|
||||
return false
|
||||
}
|
12
server/wheelserver/app/export.go
Normal file
12
server/wheelserver/app/export.go
Normal file
@ -0,0 +1,12 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"main/constant"
|
||||
"main/global"
|
||||
)
|
||||
|
||||
var _app = new(app)
|
||||
|
||||
func init() {
|
||||
global.RegModule(constant.APP_MODULE_IDX, _app)
|
||||
}
|
19
server/wheelserver/common/types.go
Normal file
19
server/wheelserver/common/types.go
Normal file
@ -0,0 +1,19 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
type NftHomeMeta struct {
|
||||
Name string `json:"name"`
|
||||
Symbol string `json:"symbol"`
|
||||
Description string `json:"description"`
|
||||
Image string `json:"image"`
|
||||
ExternalLink string `json:"external_link"`
|
||||
}
|
||||
|
||||
type App interface {
|
||||
Run(func(), func())
|
||||
}
|
||||
|
||||
type RouterMgr interface{
|
||||
}
|
16
server/wheelserver/constant/constant.go
Normal file
16
server/wheelserver/constant/constant.go
Normal file
@ -0,0 +1,16 @@
|
||||
package constant
|
||||
|
||||
const (
|
||||
BCNFT_DB = "bcnftdb"
|
||||
)
|
||||
|
||||
const (
|
||||
APP_MODULE_IDX = iota
|
||||
ROUTER_MGR_MODULE_IDX
|
||||
MAX_MODULE_IDX
|
||||
)
|
||||
|
||||
const (
|
||||
CONTRACT_NAME_CFHero = "CFHero"
|
||||
CONTRACT_NAME_GoldBrick = "GoldBrick"
|
||||
)
|
57
server/wheelserver/global/global.go
Normal file
57
server/wheelserver/global/global.go
Normal file
@ -0,0 +1,57 @@
|
||||
package global
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"main/common"
|
||||
"main/constant"
|
||||
"q5"
|
||||
)
|
||||
|
||||
var modules [constant.MAX_MODULE_IDX]q5.Module
|
||||
var initOrders = []int32{
|
||||
constant.ROUTER_MGR_MODULE_IDX,
|
||||
}
|
||||
|
||||
var app common.App
|
||||
var routerMgr common.RouterMgr
|
||||
|
||||
func GetApp() common.App {
|
||||
return app
|
||||
}
|
||||
|
||||
func GetRouterMgr() common.RouterMgr {
|
||||
return routerMgr
|
||||
}
|
||||
|
||||
func RegModule(idx int32, m q5.Module) {
|
||||
fmt.Printf("RegModule module %d\n", idx)
|
||||
modules[idx] = m
|
||||
switch idx {
|
||||
case constant.APP_MODULE_IDX:
|
||||
{
|
||||
app = m.(common.App)
|
||||
}
|
||||
case constant.ROUTER_MGR_MODULE_IDX:
|
||||
{
|
||||
routerMgr = m.(common.RouterMgr)
|
||||
}
|
||||
default:
|
||||
{
|
||||
panic("unknow module")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func InitModules() {
|
||||
for _, val := range initOrders {
|
||||
fmt.Printf("init module %d\n", val)
|
||||
modules[val].Init()
|
||||
}
|
||||
}
|
||||
|
||||
func UnInitModules() {
|
||||
for _, val := range initOrders {
|
||||
fmt.Printf("unInit module %d", val)
|
||||
modules[val].UnInit()
|
||||
}
|
||||
}
|
63
server/wheelserver/go.mod
Normal file
63
server/wheelserver/go.mod
Normal file
@ -0,0 +1,63 @@
|
||||
module wheelserver
|
||||
|
||||
go 1.20
|
||||
|
||||
require q5 v1.0.0
|
||||
|
||||
require f5 v1.0.0
|
||||
|
||||
require jccommon v1.0.0
|
||||
|
||||
require (
|
||||
golang.org/x/sync v0.6.0 // indirect
|
||||
gopkg.in/go-jose/go-jose.v2 v2.6.2 // indirect
|
||||
)
|
||||
|
||||
require main v1.0.0
|
||||
|
||||
require github.com/gin-gonic/gin v1.10.0
|
||||
|
||||
require (
|
||||
github.com/auth0/go-jwt-middleware/v2 v2.2.1
|
||||
github.com/bytedance/sonic v1.11.6 // indirect
|
||||
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
||||
github.com/cloudwego/base64x v0.1.4 // indirect
|
||||
github.com/cloudwego/iasm v0.2.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.20.0 // indirect
|
||||
github.com/go-sql-driver/mysql v1.7.0 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/gomodule/redigo v1.8.3 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/joho/godotenv v1.5.1
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||
golang.org/x/arch v0.8.0 // indirect
|
||||
golang.org/x/crypto v0.23.0 // indirect
|
||||
golang.org/x/net v0.25.0 // indirect
|
||||
golang.org/x/sys v0.20.0 // indirect
|
||||
golang.org/x/text v0.15.0 // indirect
|
||||
google.golang.org/protobuf v1.34.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
gorm.io/driver/mysql v1.5.1 // indirect
|
||||
gorm.io/gorm v1.25.1 // indirect
|
||||
)
|
||||
|
||||
replace q5 => ../../third_party/q5
|
||||
|
||||
replace f5 => ../../third_party/f5
|
||||
|
||||
replace jccommon => ../jccommon
|
||||
|
||||
replace main => ./
|
113
server/wheelserver/go.sum
Normal file
113
server/wheelserver/go.sum
Normal file
@ -0,0 +1,113 @@
|
||||
github.com/auth0/go-jwt-middleware/v2 v2.2.0/go.mod h1:BFCz+RF+1szSkrGNJLYn2ng2PtfzBiKR6fynTvS2A/k=
|
||||
github.com/auth0/go-jwt-middleware/v2 v2.2.1 h1:pqxEIwlCztD0T9ZygGfOrw4NK/F9iotnCnPJVADKbkE=
|
||||
github.com/auth0/go-jwt-middleware/v2 v2.2.1/go.mod h1:CSi0tuu0QrALbWdiQZwqFL8SbBhj4e2MJzkvNfjY0Us=
|
||||
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
||||
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
||||
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpVsBuRksnlj1mLy4AWzRNQYxauNi62uWcE3to6eA=
|
||||
github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=
|
||||
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
||||
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
|
||||
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
|
||||
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/gomodule/redigo v1.8.3 h1:HR0kYDX2RJZvAup8CsiJwxB4dTCSC0AaUq6S4SiLwUc=
|
||||
github.com/gomodule/redigo v1.8.3/go.mod h1:P9dn9mFrCBvWhGE1wpxx6fgq7BAeLBk+UUUzlpkBYO0=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
||||
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
||||
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
|
||||
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
|
||||
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/go-jose/go-jose.v2 v2.6.2 h1:Rl5+9rA0kG3vsO1qhncMPRT5eHICihAMQYJkD7u/i4M=
|
||||
gopkg.in/go-jose/go-jose.v2 v2.6.2/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEIoEdZlFBI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gorm.io/driver/mysql v1.5.1 h1:WUEH5VF9obL/lTtzjmML/5e6VfFR/788coz2uaVCAZw=
|
||||
gorm.io/driver/mysql v1.5.1/go.mod h1:Jo3Xu7mMhCyj8dlrb3WoCaRd1FhsVh+yMXb1jUInf5o=
|
||||
gorm.io/gorm v1.25.1 h1:nsSALe5Pr+cM3V1qwwQ7rOkw+6UeLrX5O4v3llhHa64=
|
||||
gorm.io/gorm v1.25.1/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
11
server/wheelserver/initialize/enter.go
Normal file
11
server/wheelserver/initialize/enter.go
Normal file
@ -0,0 +1,11 @@
|
||||
package initialize
|
||||
|
||||
import (
|
||||
_ "main/app"
|
||||
. "main/global"
|
||||
_ "main/router"
|
||||
)
|
||||
|
||||
func Init() {
|
||||
GetApp().Run(InitModules, UnInitModules)
|
||||
}
|
9
server/wheelserver/main.go
Normal file
9
server/wheelserver/main.go
Normal file
@ -0,0 +1,9 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"main/initialize"
|
||||
)
|
||||
|
||||
func main() {
|
||||
initialize.Init()
|
||||
}
|
17
server/wheelserver/makefile
Normal file
17
server/wheelserver/makefile
Normal file
@ -0,0 +1,17 @@
|
||||
compile:
|
||||
@. /etc/profile
|
||||
|
||||
@export GOPROXY=https://goproxy.io
|
||||
@go build -gcflags=all="-N -l" -o ../../bin/wheelserver/bin
|
||||
@echo "compile done"
|
||||
|
||||
debug:
|
||||
@. /etc/profile
|
||||
|
||||
@export GOPROXY=https://goproxy.io
|
||||
@go build -gcflags=all="-N -l" -ldflags "-X q5.optDebug=1" -o ../../bin/wheelserver/bin
|
||||
@echo "compile done"
|
||||
|
||||
clean:
|
||||
@rm -f ../../bin/wheelserver/bin
|
||||
@echo "clean done"
|
26
server/wheelserver/mt/Config.go
Normal file
26
server/wheelserver/mt/Config.go
Normal file
@ -0,0 +1,26 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mtb"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
mtb.Config
|
||||
}
|
||||
|
||||
type ConfigTable struct {
|
||||
f5.IdMetaTable[Config]
|
||||
selfConf *Config
|
||||
}
|
||||
|
||||
func (this *ConfigTable) GetGameApiUrl() string {
|
||||
return this.selfConf.GetGameapiUrl()
|
||||
}
|
||||
|
||||
func (this *ConfigTable) PostInit1() {
|
||||
this.selfConf = this.GetById(int64(0))
|
||||
if this.selfConf == nil {
|
||||
panic("无法读取config.json")
|
||||
}
|
||||
}
|
89
server/wheelserver/mt/Contract.go
Normal file
89
server/wheelserver/mt/Contract.go
Normal file
@ -0,0 +1,89 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"f5"
|
||||
"fmt"
|
||||
"q5"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Contract struct {
|
||||
name string
|
||||
address string
|
||||
}
|
||||
|
||||
type ContractTable struct {
|
||||
netIdNameHash *q5.ConcurrentMap[string, *Contract]
|
||||
}
|
||||
|
||||
func (this *Contract) GetName() string {
|
||||
return this.name
|
||||
}
|
||||
|
||||
func (this *Contract) GetAddress() string {
|
||||
return this.address
|
||||
}
|
||||
|
||||
func (this *ContractTable) IsNoLoad() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (this *ContractTable) Load() {
|
||||
this.netIdNameHash = new(q5.ConcurrentMap[string, *Contract])
|
||||
nets := []interface{}{}
|
||||
{
|
||||
if jsonStr, err := f5.ReadJsonFile("../config/nets.json"); err == nil {
|
||||
if err := json.Unmarshal([]byte(jsonStr), &nets); err != nil {
|
||||
panic(fmt.Sprintf("load metafile json decode error %s %s", "nets.json", err))
|
||||
}
|
||||
} else {
|
||||
panic(fmt.Sprintf("load metafile error %s %s", "nets.json", err))
|
||||
}
|
||||
}
|
||||
{
|
||||
for _, val := range nets {
|
||||
netId := q5.SafeToInt32(val)
|
||||
fileName := fmt.Sprintf("../config/nets/%d/contract.json", netId)
|
||||
if jsonStr, err := f5.ReadJsonFile(fileName); err == nil {
|
||||
contracts := []struct {
|
||||
Name string `json:"name"`
|
||||
Address string `json:"address"`
|
||||
}{}
|
||||
if err := json.Unmarshal([]byte(jsonStr), &contracts); err != nil {
|
||||
panic(fmt.Sprintf("load metafile json decode error %s %s", "contract.json", err))
|
||||
}
|
||||
for _, val2 := range contracts {
|
||||
p := new(Contract)
|
||||
p.name = q5.SafeToString(val2.Name)
|
||||
p.address = strings.ToLower(q5.SafeToString(val2.Address))
|
||||
key := fmt.Sprintf("%d_%s", netId, p.name)
|
||||
this.netIdNameHash.Store(key, p)
|
||||
}
|
||||
} else {
|
||||
panic(fmt.Sprintf("load metafile error %s %s", "contract.json", err))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (this *ContractTable) PreInit1() {
|
||||
|
||||
}
|
||||
|
||||
func (this *ContractTable) ElementsInit(int) {
|
||||
|
||||
}
|
||||
|
||||
func (this *ContractTable) PostInit1() {
|
||||
|
||||
}
|
||||
|
||||
func (this *ContractTable) GetByNetIdName(netId int32, name string) *Contract {
|
||||
key := fmt.Sprintf("%d_%s", netId, name)
|
||||
if v, ok := this.netIdNameHash.Load(key); ok {
|
||||
return *v
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
17
server/wheelserver/mt/NftDb.go
Normal file
17
server/wheelserver/mt/NftDb.go
Normal file
@ -0,0 +1,17 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mtb"
|
||||
)
|
||||
|
||||
type NftDb struct {
|
||||
mtb.NftDb
|
||||
}
|
||||
|
||||
type NftDbTable struct {
|
||||
f5.IdMetaTable[NftDb]
|
||||
}
|
||||
|
||||
func (this *NftDb) Init1() {
|
||||
}
|
35
server/wheelserver/mt/NftHomeMeta.go
Normal file
35
server/wheelserver/mt/NftHomeMeta.go
Normal file
@ -0,0 +1,35 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mtb"
|
||||
)
|
||||
|
||||
type NftHomeMeta struct {
|
||||
mtb.NftHomeMeta
|
||||
}
|
||||
|
||||
type NftHomeMetaTable struct {
|
||||
f5.NameMetaTable[NftHomeMeta]
|
||||
hero *NftHomeMeta
|
||||
newHero *NftHomeMeta
|
||||
goldBullion *NftHomeMeta
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
34
server/wheelserver/mt/NftServerCluster.go
Normal file
34
server/wheelserver/mt/NftServerCluster.go
Normal file
@ -0,0 +1,34 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mtb"
|
||||
)
|
||||
|
||||
type NftServerCluster struct {
|
||||
mtb.NftServerCluster
|
||||
}
|
||||
|
||||
type NftServerClusterTable struct {
|
||||
f5.IdMetaTable[NftServerCluster]
|
||||
selfConf *NftServerCluster
|
||||
}
|
||||
|
||||
func (this *NftServerCluster) Init1() {
|
||||
|
||||
}
|
||||
|
||||
func (this *NftServerClusterTable) GetListenPort() int32 {
|
||||
return this.selfConf.GetListenPort()
|
||||
}
|
||||
|
||||
func (this *NftServerClusterTable) GetHttpListenPort() int32 {
|
||||
return this.selfConf.GetHttpListenPort()
|
||||
}
|
||||
|
||||
func (this *NftServerClusterTable) PostInit1() {
|
||||
this.selfConf = this.GetById(int64(f5.GetApp().GetInstanceId()))
|
||||
if this.selfConf == nil {
|
||||
panic("loginserver集群无法读取本服配置")
|
||||
}
|
||||
}
|
39
server/wheelserver/mt/export.go
Normal file
39
server/wheelserver/mt/export.go
Normal file
@ -0,0 +1,39 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
)
|
||||
|
||||
type table struct {
|
||||
NftServerCluster *NftServerClusterTable
|
||||
//NftDb *NftDbTable
|
||||
Config *ConfigTable
|
||||
NftHomeMeta *NftHomeMetaTable
|
||||
//Contract *ContractTable
|
||||
}
|
||||
|
||||
var Table = f5.New(func(this *table) {
|
||||
this.NftServerCluster = f5.New(func(this *NftServerClusterTable) {
|
||||
this.FileName = "../config/nftserver.cluster.json"
|
||||
this.PrimKey = "instance_id"
|
||||
})
|
||||
|
||||
/*
|
||||
this.NftDb = f5.New(func(this *NftDbTable) {
|
||||
this.FileName = "../config/nftdb.mysql.json"
|
||||
this.PrimKey = ""
|
||||
})*/
|
||||
|
||||
this.Config = f5.New(func(this *ConfigTable) {
|
||||
this.FileName = "../config/config.json"
|
||||
this.PrimKey = ""
|
||||
})
|
||||
|
||||
this.NftHomeMeta = f5.New(func(this *NftHomeMetaTable) {
|
||||
this.FileName = "../config/nft_home_meta.json"
|
||||
this.PrimKey = "name"
|
||||
})
|
||||
|
||||
//this.Contract = new(ContractTable)
|
||||
|
||||
})
|
192
server/wheelserver/mtb/mtb.auto_gen.go
Normal file
192
server/wheelserver/mtb/mtb.auto_gen.go
Normal file
@ -0,0 +1,192 @@
|
||||
package mtb
|
||||
|
||||
import (
|
||||
"f5"
|
||||
)
|
||||
|
||||
type NftServerCluster struct {
|
||||
instance_id int32
|
||||
listen_port int32
|
||||
http_listen_port int32
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type NftDb struct {
|
||||
host string
|
||||
port int32
|
||||
user string
|
||||
passwd string
|
||||
database string
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
gameapi_url string
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type NftHomeMeta struct {
|
||||
name string
|
||||
nft_name string
|
||||
nft_symbol string
|
||||
nft_description string
|
||||
nft_image string
|
||||
nft_external_link string
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
func (this *NftServerCluster) GetInstanceId() int32 {
|
||||
return this.instance_id
|
||||
}
|
||||
|
||||
func (this *NftServerCluster) HasInstanceId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *NftServerCluster) GetListenPort() int32 {
|
||||
return this.listen_port
|
||||
}
|
||||
|
||||
func (this *NftServerCluster) HasListenPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *NftServerCluster) GetHttpListenPort() int32 {
|
||||
return this.http_listen_port
|
||||
}
|
||||
|
||||
func (this *NftServerCluster) HasHttpListenPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *NftDb) GetHost() string {
|
||||
return this.host
|
||||
}
|
||||
|
||||
func (this *NftDb) HasHost() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *NftDb) GetPort() int32 {
|
||||
return this.port
|
||||
}
|
||||
|
||||
func (this *NftDb) HasPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *NftDb) GetUser() string {
|
||||
return this.user
|
||||
}
|
||||
|
||||
func (this *NftDb) HasUser() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *NftDb) GetPasswd() string {
|
||||
return this.passwd
|
||||
}
|
||||
|
||||
func (this *NftDb) HasPasswd() bool {
|
||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||
}
|
||||
|
||||
func (this *NftDb) GetDatabase() string {
|
||||
return this.database
|
||||
}
|
||||
|
||||
func (this *NftDb) HasDatabase() bool {
|
||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
||||
}
|
||||
|
||||
func (this *Config) GetGameapiUrl() string {
|
||||
return this.gameapi_url
|
||||
}
|
||||
|
||||
func (this *Config) HasGameapiUrl() 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) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *NftHomeMeta) GetNftName() string {
|
||||
return this.nft_name
|
||||
}
|
||||
|
||||
func (this *NftHomeMeta) HasNftName() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *NftHomeMeta) GetNftSymbol() string {
|
||||
return this.nft_symbol
|
||||
}
|
||||
|
||||
func (this *NftHomeMeta) HasNftSymbol() bool {
|
||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||
}
|
||||
|
||||
func (this *NftHomeMeta) GetNftDescription() string {
|
||||
return this.nft_description
|
||||
}
|
||||
|
||||
func (this *NftHomeMeta) HasNftDescription() bool {
|
||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
||||
}
|
||||
|
||||
func (this *NftHomeMeta) GetNftImage() string {
|
||||
return this.nft_image
|
||||
}
|
||||
|
||||
func (this *NftHomeMeta) HasNftImage() bool {
|
||||
return (this._flags1_ & (uint64(1) << 6)) > 0
|
||||
}
|
||||
|
||||
func (this *NftHomeMeta) GetNftExternalLink() string {
|
||||
return this.nft_external_link
|
||||
}
|
||||
|
||||
func (this *NftHomeMeta) HasNftExternalLink() 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)
|
||||
f5.ReadMetaTableField(&this.listen_port, "listen_port", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.http_listen_port, "http_listen_port", &this._flags1_, 3, kv)
|
||||
}
|
||||
|
||||
func (this *NftDb) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.host, "host", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.port, "port", &this._flags1_, 2, kv)
|
||||
f5.ReadMetaTableField(&this.user, "user", &this._flags1_, 3, kv)
|
||||
f5.ReadMetaTableField(&this.passwd, "passwd", &this._flags1_, 4, kv)
|
||||
f5.ReadMetaTableField(&this.database, "database", &this._flags1_, 5, kv)
|
||||
}
|
||||
|
||||
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.name, "name", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.nft_name, "nft_name", &this._flags1_, 3, kv)
|
||||
f5.ReadMetaTableField(&this.nft_symbol, "nft_symbol", &this._flags1_, 4, kv)
|
||||
f5.ReadMetaTableField(&this.nft_description, "nft_description", &this._flags1_, 5, kv)
|
||||
f5.ReadMetaTableField(&this.nft_image, "nft_image", &this._flags1_, 6, kv)
|
||||
f5.ReadMetaTableField(&this.nft_external_link, "nft_external_link", &this._flags1_, 7, kv)
|
||||
}
|
34
server/wheelserver/proto/mt.proto
Normal file
34
server/wheelserver/proto/mt.proto
Normal file
@ -0,0 +1,34 @@
|
||||
package mt;
|
||||
|
||||
option go_package = ".;mt";
|
||||
|
||||
message NftServerCluster
|
||||
{
|
||||
optional int32 instance_id = 1;
|
||||
optional int32 listen_port = 2;
|
||||
optional int32 http_listen_port = 3;
|
||||
}
|
||||
|
||||
message NftDb
|
||||
{
|
||||
optional string host = 1;
|
||||
optional int32 port = 2;
|
||||
optional string user = 3;
|
||||
optional string passwd = 4;
|
||||
optional string database = 5;
|
||||
}
|
||||
|
||||
message Config
|
||||
{
|
||||
optional string gameapi_url = 1;
|
||||
}
|
||||
|
||||
message NftHomeMeta
|
||||
{
|
||||
optional string name = 1;
|
||||
optional string nft_name = 3;
|
||||
optional string nft_symbol = 4;
|
||||
optional string nft_description = 5;
|
||||
optional string nft_image = 6;
|
||||
optional string nft_external_link = 7;
|
||||
}
|
2
server/wheelserver/proto/protoc-gen.bat
Normal file
2
server/wheelserver/proto/protoc-gen.bat
Normal file
@ -0,0 +1,2 @@
|
||||
protoc --go_out=..\cs .\cs_*.proto
|
||||
protoc --go_out=..\ss .\ss_*.proto
|
12
server/wheelserver/router/export.go
Normal file
12
server/wheelserver/router/export.go
Normal file
@ -0,0 +1,12 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"main/constant"
|
||||
"main/global"
|
||||
)
|
||||
|
||||
var _routerMgr = new(routerMgr)
|
||||
|
||||
func init() {
|
||||
global.RegModule(constant.ROUTER_MGR_MODULE_IDX, _routerMgr)
|
||||
}
|
6
server/wheelserver/router/nft/enter.go
Normal file
6
server/wheelserver/router/nft/enter.go
Normal file
@ -0,0 +1,6 @@
|
||||
package nft
|
||||
|
||||
type RouterGroup struct {
|
||||
NftMetaRouter
|
||||
NftDetailRouter
|
||||
}
|
14
server/wheelserver/router/nft/nftdetail.go
Normal file
14
server/wheelserver/router/nft/nftdetail.go
Normal file
@ -0,0 +1,14 @@
|
||||
package nft
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/api/v1"
|
||||
)
|
||||
|
||||
type NftDetailRouter struct{}
|
||||
|
||||
func (this *NftDetailRouter) InitRouter() {
|
||||
api := v1.ApiGroupApp.NftApiGroup
|
||||
f5.GetApp().GetGinEngine().GET("/hero/detail/:netId/:tokenId", api.NftDetailApi.Hero)
|
||||
f5.GetApp().GetGinEngine().GET("/gold_bullion/detail/:netId/:tokenId", api.NftDetailApi.GoldBullion)
|
||||
}
|
18
server/wheelserver/router/nft/nftmeta.go
Normal file
18
server/wheelserver/router/nft/nftmeta.go
Normal file
@ -0,0 +1,18 @@
|
||||
package nft
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/api/v1"
|
||||
)
|
||||
|
||||
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("/newhero/home_meta/:netId", api.NftMetaApi.NewHeroHome)
|
||||
f5.GetApp().GetGinEngine().GET("/gold_bullion/home_meta/:netId", api.NftMetaApi.GoldBullionHome)
|
||||
}
|
25
server/wheelserver/router/routermgr.go
Normal file
25
server/wheelserver/router/routermgr.go
Normal file
@ -0,0 +1,25 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/router/nft"
|
||||
)
|
||||
|
||||
type routerMgr struct {
|
||||
nft nft.RouterGroup
|
||||
}
|
||||
|
||||
func (this *routerMgr) Init() {
|
||||
/*
|
||||
f5.GetApp().GetGinEngine().Use(middleware.Cors())
|
||||
*/
|
||||
this.nft.NftMetaRouter.InitRouter()
|
||||
this.nft.NftDetailRouter.InitRouter()
|
||||
|
||||
f5.GetSysLog().Info("routerMgr.init")
|
||||
|
||||
}
|
||||
|
||||
func (this *routerMgr) UnInit() {
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user